Skip to content

Commit

Permalink
Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
ysiraichi committed Apr 3, 2024
1 parent 508aa26 commit d42a5bd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/dynamo/test_dynamo.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,24 @@ def test_all_cpu_tensor(self):
self.assertIn('MarkStep', met.counter_names())


class DynamoOperationsTests(test_utils.XlaTestCase):

def test_new_with_sizes(self):

def foo(x):
return x.new(*x.sizes()) + x

optfoo = torch.compile(backend="openxla")(foo)

t = torch.arange(10)
Xt = t.to(xm.xla_device())

expected = foo(t)
actual = optfoo(Xt)

self.assertEqual(expected, actual.cpu())


if __name__ == '__main__':
test = unittest.main()
sys.exit(0 if test.result.wasSuccessful() else 1)

0 comments on commit d42a5bd

Please sign in to comment.