MCPcopy Create free account
hub / github.com/numpy/numpy / test_device_property

Function test_device_property

numpy/array_api/tests/test_array_object.py:313–321  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

311
312
313def test_device_property():
314 a = ones((3, 4))
315 assert a.device == 'cpu'
316
317 assert all(equal(a.to_device('cpu'), a))
318 assert_raises(ValueError, lambda: a.to_device('gpu'))
319
320 assert all(equal(asarray(a, device='cpu'), a))
321 assert_raises(ValueError, lambda: asarray(a, device='gpu'))
322
323def test_array_properties():
324 a = ones((1, 2, 3))

Callers

nothing calls this directly

Calls 6

assert_raisesFunction · 0.90
to_deviceMethod · 0.80
onesFunction · 0.50
allFunction · 0.50
equalFunction · 0.50
asarrayFunction · 0.50

Tested by

no test coverage detected