mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/28433
Differential Revision: D18138240 Pulled By: anjali411 fbshipit-source-id: 314e5902f103be1feb4cacde47c90204b3d353cc
This commit is contained in:
committed by
Facebook Github Bot
parent
3f119a5f52
commit
dc17a2ecc5
@@ -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}) {
|
||||
|
||||
Reference in New Issue
Block a user