We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
array_api
1 parent d521053 commit 3a57d82Copy full SHA for 3a57d82
array_api_strict/tests/test_array_object.py
@@ -285,3 +285,14 @@ def test_python_scalar_construtors():
285
286
assert_raises(TypeError, lambda: operator.index(b))
287
assert_raises(TypeError, lambda: operator.index(f))
288
+
289
290
+def test_device_property():
291
+ a = ones((3, 4))
292
+ assert a.device == 'cpu'
293
294
+ assert np.array_equal(a.to_device('cpu'), a)
295
+ assert_raises(ValueError, lambda: a.to_device('gpu'))
296
297
+ assert np.array_equal(asarray(a, device='cpu'), a)
298
+ assert_raises(ValueError, lambda: asarray(a, device='gpu'))
0 commit comments