Example #1
0
 def test_gradcheck(self, device, dtype):
     B, C, H, W = 2, 3, 4, 4
     img = torch.rand(B,
                      C,
                      H,
                      W,
                      device=device,
                      dtype=torch.float64,
                      requires_grad=True)
     img = kornia.rgb_to_luv(img)
     assert gradcheck(kornia.color.luv_to_rgb, (img, ),
                      raise_exception=True)
Example #2
0
    def test_grad(self, device):

        data = kornia.rgb_to_luv(torch.rand(2, 3, 4, 5).to(device))
        data = utils.tensor_to_gradcheck_var(data)
        assert gradcheck(kornia.color.LuvToRgb(), (data, ),
                         raise_exception=True)