From 1e53faeb2ef7f3b6e68a4d10113cd889c95acc4f Mon Sep 17 00:00:00 2001 From: Lysandre Debut Date: Tue, 26 Oct 2021 22:20:51 -0400 Subject: [PATCH] Fix gelu test for torch 1.10 (#14167) --- tests/test_activations.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_activations.py b/tests/test_activations.py index fe15caf819..4cc27fec48 100644 --- a/tests/test_activations.py +++ b/tests/test_activations.py @@ -29,8 +29,8 @@ class TestActivations(unittest.TestCase): def test_gelu_versions(self): x = torch.tensor([-100, -1, -0.1, 0, 0.1, 1.0, 100]) torch_builtin = get_activation("gelu") - self.assertTrue(torch.eq(_gelu_python(x), torch_builtin(x)).all().item()) - self.assertFalse(torch.eq(_gelu_python(x), gelu_new(x)).all().item()) + self.assertTrue(torch.allclose(_gelu_python(x), torch_builtin(x))) + self.assertFalse(torch.allclose(_gelu_python(x), gelu_new(x))) def test_get_activation(self): get_activation("swish")