Skip to content

Commit

Permalink
Add relative threshold while testing inversing (#8973)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yipeng1994 authored Aug 20, 2022
1 parent 8f5745b commit 0d91cf6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/oneflow/test/modules/test_inv.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@

@flow.unittest.skip_unless_1n1d()
class TestLinalgInv(flow.unittest.TestCase):
@autotest(n=5)
@autotest(n=5, rtol=1e-2)
def test_inv_3by3_with_random_data(test_case):
device = random_device()
x = random_tensor(ndim=2, dim0=3, dim1=3, low=-1).to(device)
return torch.linalg.inv(x)

@autotest(n=5)
@autotest(n=5, rtol=1e-2)
def test_inv_batch_3by3_with_random_data(test_case):
device = random_device()
x = random_tensor(ndim=3, dim0=random(), dim1=3, dim2=3, low=-1).to(device)
return torch.linalg.inv(x)

@autotest(n=5, rtol=1e-3, atol=1e-3)
@autotest(n=5, rtol=1e-2)
def test_inv_random_square_with_random_data(test_case):
device = random_device()
square_dim = random()
Expand Down

0 comments on commit 0d91cf6

Please sign in to comment.