Beispiel #1
0
 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()
Beispiel #2
0
 def test_cumprod_numpy_array(self, dtype):
     a_numpy = numpy.arange(1, 6, dtype=dtype)
     with self.assertRaises(TypeError):
         return cupy.cumprod(a_numpy)
Beispiel #3
0
 def test_cumprod_arraylike(self):
     with self.assertRaises(TypeError):
         return cupy.cumprod((1, 2, 3))
Beispiel #4
0
 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)
Beispiel #5
0
 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)
Beispiel #6
0
 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())
Beispiel #7
0
 def test_cumprod_arraylike(self):
     with pytest.raises(TypeError):
         return cupy.cumprod((1, 2, 3))