def test_cumprod_huge_array(self): size = 2**32 # Free huge memory for slow test cupy.get_default_memory_pool().free_all_blocks() a = cupy.ones(size, 'b') result = cupy.cumprod(a, dtype='b') del a assert (result == 1).all() # Free huge memory for slow test del result cupy.get_default_memory_pool().free_all_blocks()
def test_cumprod_numpy_array(self, dtype): a_numpy = numpy.arange(1, 6, dtype=dtype) with self.assertRaises(TypeError): return cupy.cumprod(a_numpy)
def test_cumprod_arraylike(self): with self.assertRaises(TypeError): return cupy.cumprod((1, 2, 3))
def test_invalid_axis_upper2(self, dtype): a = testing.shaped_arange((4, 5), cupy, dtype) with self.assertRaises(numpy.AxisError): return cupy.cumprod(a, axis=a.ndim)
def test_invalid_axis_lower2(self, dtype): a = testing.shaped_arange((4, 5), cupy, dtype) with self.assertRaises(cupy.core._AxisError): return cupy.cumprod(a, axis=-a.ndim - 1)
def test_cumprod_huge_array(self): size = 2**32 a = cupy.ones(size, 'b') result = cupy.cumprod(a, dtype='b') del a self.assertTrue((result == 1).all())
def test_cumprod_arraylike(self): with pytest.raises(TypeError): return cupy.cumprod((1, 2, 3))