We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
array_api
1 parent d9c3689 commit bc087bbCopy full SHA for bc087bb
numpy/array_api/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