mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
Add temporary torch::k{name} enum declarations (#27051)
Summary:
This PR adds temporary declarations for `torch::k{name}` enums, so that we can submit a PR to rename the enum usage in torchvision. And then, after the changes to torchvision is done, we can remove the temporary declarations in https://github.com/pytorch/pytorch/pull/26837 to officially move over to using `c10::variant` for enums.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27051
Differential Revision: D17672220
Pulled By: yf225
fbshipit-source-id: 4ae77634e8c7efa3404698f7c1a69177cbb5dab3
This commit is contained in:
committed by
Facebook Github Bot
parent
9159a601ca
commit
27d4b34ea6
@@ -110,19 +110,19 @@ TEST(InitTest, CanInitializeTensorThatRequiresGrad) {
|
||||
|
||||
TEST(InitTest, CalculateGainWithTanh) {
|
||||
double gain =
|
||||
torch::nn::init::calculate_gain(torch::nn::init::Nonlinearity::Tanh);
|
||||
torch::nn::init::calculate_gain(torch::kTanh);
|
||||
ASSERT_DOUBLE_EQ(gain, 5.0 / 3.0);
|
||||
}
|
||||
|
||||
TEST(InitTest, CalculateGainWithRelu) {
|
||||
double gain =
|
||||
torch::nn::init::calculate_gain(torch::nn::init::Nonlinearity::ReLU);
|
||||
torch::nn::init::calculate_gain(torch::kReLU);
|
||||
ASSERT_DOUBLE_EQ(gain, std::sqrt(2.0));
|
||||
}
|
||||
|
||||
TEST(InitTest, CalculateGainWithLeakyRelu) {
|
||||
double gain =
|
||||
torch::nn::init::calculate_gain(torch::nn::init::Nonlinearity::LeakyReLU);
|
||||
torch::nn::init::calculate_gain(torch::kLeakyReLU);
|
||||
ASSERT_DOUBLE_EQ(gain, std::sqrt(2.0 / (1 + pow(0.01, 2))));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user