Ejemplo n.º 1
0
 def test_roll_torch_1d_shift(self):
     output = roll(self.test_torch, shift=1, axis=0)
     self.assertTrue(is_equal(output, self.test_output_torch_1d))
Ejemplo n.º 2
0
 def test_roll_torch_2d_shift(self):
     output = roll(self.test_torch, shift=[-1, -1], axis=[0, 1])
     self.assertTrue(is_equal(output, self.test_output_torch_2d))
Ejemplo n.º 3
0
 def test_sign_torch_type(self):
     output = roll(self.test_torch, shift=1, axis=0)
     self.assertIsInstance(output, torch.Tensor,
                           'Output type must be torch.Tensor')
Ejemplo n.º 4
0
 def test_roll_tf_type(self):
     output = roll(self.test_tf, shift=0, axis=1)
     self.assertIsInstance(output, tf.Tensor,
                           'Output type must be tf.Tensor')
Ejemplo n.º 5
0
 def test_roll_np_2d_shift(self):
     output = roll(self.test_np, shift=[-1, -1], axis=[0, 1])
     self.assertTrue(np.array_equal(output, self.test_output_np_2d))
Ejemplo n.º 6
0
 def test_roll_np_1d_shift(self):
     output = roll(self.test_np, shift=1, axis=0)
     self.assertTrue(np.array_equal(output, self.test_output_np_1d))
Ejemplo n.º 7
0
 def test_roll_np_type(self):
     output = roll(self.test_np, shift=1, axis=0)
     self.assertIsInstance(output, np.ndarray,
                           'Output type must be NumPy array')