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
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)
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')
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
def test_deepcopy(self): arr = _core.ndarray(self.shape) arr2 = copy.deepcopy(arr) self._check_deepcopy(arr, arr2)
def setUp(self): self.a = _core.ndarray(())