Exemplo n.º 1
0
 def test_vflip(self):
     img_tensor = torch.randn(3, 16, 16)
     img_tensor_clone = img_tensor.clone()
     vflipped_img = F_t.vflip(img_tensor)
     vflipped_img_again = F_t.vflip(vflipped_img)
     self.assertEqual(vflipped_img.shape, img_tensor.shape)
     self.assertTrue(torch.equal(img_tensor, vflipped_img_again))
     self.assertTrue(torch.equal(img_tensor, img_tensor_clone))
Exemplo n.º 2
0
 def test_vflip(self):
     script_vflip = torch.jit.script(F_t.vflip)
     img_tensor = torch.randn(3, 16, 16)
     img_tensor_clone = img_tensor.clone()
     vflipped_img = F_t.vflip(img_tensor)
     vflipped_img_again = F_t.vflip(vflipped_img)
     self.assertEqual(vflipped_img.shape, img_tensor.shape)
     self.assertTrue(torch.equal(img_tensor, vflipped_img_again))
     self.assertTrue(torch.equal(img_tensor, img_tensor_clone))
     # scriptable function test
     vflipped_img_script = script_vflip(img_tensor)
     self.assertTrue(torch.equal(vflipped_img, vflipped_img_script))