diff options
Diffstat (limited to 'numpy/array_api/tests/test_array_object.py')
-rw-r--r-- | numpy/array_api/tests/test_array_object.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/array_api/tests/test_array_object.py b/numpy/array_api/tests/test_array_object.py index 7959f92b4..fb42cf621 100644 --- a/numpy/array_api/tests/test_array_object.py +++ b/numpy/array_api/tests/test_array_object.py @@ -285,3 +285,14 @@ def test_python_scalar_construtors(): assert_raises(TypeError, lambda: operator.index(b)) assert_raises(TypeError, lambda: operator.index(f)) + + +def test_device_property(): + a = ones((3, 4)) + assert a.device == 'cpu' + + assert np.array_equal(a.to_device('cpu'), a) + assert_raises(ValueError, lambda: a.to_device('gpu')) + + assert np.array_equal(asarray(a, device='cpu'), a) + assert_raises(ValueError, lambda: asarray(a, device='gpu')) |