Skip to content

Commit 2febad4

Browse files
committed
Fix allclose check in case of NaNs
1 parent 489d5f3 commit 2febad4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/nn/dense/test_linear.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ def test_copy_linear(lazy):
9494
assert torch.allclose(copied_lin.weight, lin.weight)
9595
assert id(copied_lin.bias) != id(lin.bias)
9696
assert copied_lin.bias.data_ptr() != lin.bias.data_ptr()
97-
assert torch.allclose(copied_lin.bias, lin.bias, atol=1e-6)
97+
if int(torch.isnan(lin.bias).sum()) == 0:
98+
assert torch.allclose(copied_lin.bias, lin.bias)
9899

99100

100101
def test_hetero_linear():

0 commit comments

Comments
 (0)