Differential Revision: D18138240

Pulled By: anjali411

fbshipit-source-id: 314e5902f103be1feb4cacde47c90204b3d353cc
This commit is contained in:
anjali411
2019-10-25 11:41:43 -07:00
committed by Facebook Github Bot
parent 3f119a5f52
commit dc17a2ecc5
2 changed files with 14 additions and 0 deletions
+10
View File
@@ -959,6 +959,16 @@ TEST_F(FunctionalTest, Normalize) {
}
}
TEST_F(FunctionalTest, GeLU) {
auto x = torch::tensor({{2., 3.}, {4., 5.}});
auto y_exp = torch::tensor({{1.9545, 2.9960}, {3.9999, 5.0000}}) +
torch::tensor({{-2.3842e-07, -4.9829e-05}, {-2.6703e-05, -1.4305e-06}});
auto y = F::gelu(x);
ASSERT_EQ(y.ndimension(), 2);
ASSERT_EQ(y.sizes(), std::vector<int64_t>({2, 2}));
ASSERT_TRUE(torch::allclose(y, y_exp));
}
TEST_F(FunctionalTest, ReLU) {
const auto size = 3;
for (const auto inplace : {false, true}) {