mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
Fix gelu test for torch 1.10 (#14167)
This commit is contained in:
parent
8ddbfe9752
commit
1e53faeb2e
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user