def test_circshift(self): input = np.array([0, 1, 2, 3]) axes = [0] shift = [1] npt.assert_allclose(util.circshift(input, shift, axes), [3, 0, 1, 2]) input = np.array([[0, 1, 2], [3, 4, 5]]) axes = [-1] shift = [2] npt.assert_allclose(util.circshift(input, shift, axes), [[1, 2, 0], [4, 5, 3]]) input = np.array([[0, 1, 2], [3, 4, 5]]) axes = [-2] shift = [1] npt.assert_allclose(util.circshift(input, shift, axes), [[3, 4, 5], [0, 1, 2]])
def _apply(self, input): return util.circshift(input, self.shift, self.axes)
def _apply(self, input): device = backend.get_device(input) with device: return util.circshift(input, self.shift, self.axes)