Esempio n. 1
0
 def test_order_none(self):
     shape = (2, 3, 4)
     a = _core.ndarray(shape, order=None)
     a_cpu = numpy.ndarray(shape, order=None)
     assert a.flags.c_contiguous == a_cpu.flags.c_contiguous
     assert a.flags.f_contiguous == a_cpu.flags.f_contiguous
     assert a.strides == a_cpu.strides
Esempio n. 2
0
 def test_copy_multi_device_non_contiguous(self, order):
     arr = _core.ndarray((20,))[::2]
     dev1 = cuda.Device(1)
     with dev1:
         arr2 = arr.copy(order)
     assert arr2.device == dev1
     testing.assert_array_equal(arr, arr2)
Esempio n. 3
0
 def test_copy_multi_device_non_contiguous_K(self):
     arr = _core.ndarray((20,))[::2]
     with cuda.Device(1):
         with pytest.raises(NotImplementedError):
             arr.copy('K')
Esempio n. 4
0
 def test_deepcopy_multi_device(self):
     arr = _core.ndarray(self.shape)
     with cuda.Device(1):
         arr2 = copy.deepcopy(arr)
     self._check_deepcopy(arr, arr2)
     assert arr2.device == arr.device
Esempio n. 5
0
 def test_deepcopy(self):
     arr = _core.ndarray(self.shape)
     arr2 = copy.deepcopy(arr)
     self._check_deepcopy(arr, arr2)
Esempio n. 6
0
 def setUp(self):
     self.a = _core.ndarray(())