示例#1
0
 def test_shift(self, dtype):
     a = cupy.ones((32,), dtype=dtype)
     shift = cupyx.scipy.ndimage.shift
     output = self._prep_output(a)
     if _util._is_integer_output(output, a) and self.mode == 'constant':
         with pytest.raises(NotImplementedError):
             shift(a, 1, output=output, order=self.order, mode=self.mode,
                   cval=self.cval)
     else:
         shift(a, 1, output=output, order=self.order, mode=self.mode,
               cval=self.cval)
示例#2
0
 def test_map_coordinates(self, dtype):
     a = cupy.ones((32,), dtype=dtype)
     coords = cupy.arange(32)[cupy.newaxis, :] + 2.5
     map_coordinates = cupyx.scipy.ndimage.map_coordinates
     output = self._prep_output(a)
     if _util._is_integer_output(output, a) and self.mode == 'constant':
         with pytest.raises(NotImplementedError):
             map_coordinates(a, coords, output=output, order=self.order,
                             mode=self.mode, cval=self.cval)
     else:
         map_coordinates(a, coords, output=output, order=self.order,
                         mode=self.mode, cval=self.cval)
示例#3
0
 def test_affine(self, dtype):
     a = cupy.ones((16, 16), dtype=dtype)
     affine = cupy.eye(2)
     affine_transform = cupyx.scipy.ndimage.affine_transform
     output = self._prep_output(a)
     if _util._is_integer_output(output, a) and self.mode == 'constant':
         with pytest.raises(NotImplementedError):
             affine_transform(a, affine, output=output, order=self.order,
                              mode=self.mode, cval=self.cval)
     else:
         affine_transform(a, affine, output=output, order=self.order,
                          mode=self.mode, cval=self.cval)
示例#4
0
 def test_rotate(self, dtype):
     a = cupy.ones((16, 16), dtype=dtype)
     rotate = cupyx.scipy.ndimage.rotate
     output = self._prep_output(a)
     if _util._is_integer_output(output, a) and self.mode == 'constant':
         with pytest.raises(NotImplementedError):
             # rotate by 0 to keep same shape
             rotate(a, 0, output=output, order=self.order, mode=self.mode,
                    cval=self.cval)
     else:
         rotate(a, 0, output=output, order=self.order, mode=self.mode,
                cval=self.cval)
示例#5
0
 def test_zoom(self, dtype):
     a = cupy.ones((32,), dtype=dtype)
     zoom = cupyx.scipy.ndimage.zoom
     output = self._prep_output(a)
     if _util._is_integer_output(output, a) and self.mode == 'constant':
         with pytest.raises(NotImplementedError):
             # zoom of 1.0 to keep same shape
             zoom(a, 1, output=output, order=self.order, mode=self.mode,
                  cval=self.cval)
     else:
         zoom(a, 1, output=output, order=self.order, mode=self.mode,
              cval=self.cval)