mirror of
https://github.com/ml-explore/mlx.git
synced 2025-10-19 00:04:41 +08:00
Async eval (#972)
This commit is contained in:
@@ -32,6 +32,18 @@ class TestEval(mlx_tests.MLXTestCase):
|
||||
mx.eval(state)
|
||||
self.assertEqual(x.item(), 3)
|
||||
|
||||
def test_async_eval(self):
|
||||
x = mx.array(1) + mx.array(1) + mx.array(1)
|
||||
sync = mx.async_eval(x)
|
||||
sync.wait()
|
||||
self.assertEqual(x.item(), 3)
|
||||
|
||||
# It should be safe to call eval on the array which has been async
|
||||
# eval'ed
|
||||
x = mx.array(1) + mx.array(1) + mx.array(1)
|
||||
sync = mx.async_eval(x)
|
||||
self.assertEqual(x.item(), 3)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
Reference in New Issue
Block a user