code: def test_exception(self, device, dtype):
      img = torch.rand(1, 2, 3, 4, device=device, dtype=dtype)
      homo = torch.eye(3, device=device, dtype=dtype)[None]
      size = (4, 5)
  
      with pytest.raises(TypeError):
          assert kornia.geometry.warp_perspective(0.0, homo, size)
  
      with pytest.raises(TypeError):
          assert kornia.geometry.warp_perspective(img, 0.0, size)
  
      with pytest.raises(ValueError):
          img = torch.rand(2, 3, 4, device=device, dtype=dtype)
          assert kornia.geometry.warp_perspective(img, homo, size)
  
      with pytest.raises(ValueError):
          homo = torch.eye(2, 2, device=device, dtype=dtype)[None]
          assert kornia.geometry.warp_perspective(img, homo, size)
  
imports: import sys
  import pytest
  import torch
  from torch.autograd import gradcheck
  import kornia
  import kornia.testing
  from kornia.testing import assert_close
  from kornia.utils._compat import torch_version, torch_version_lt
  from kornia.utils.helpers import _torch_inverse_cast
label_desc: Use image node_id 3 for calling the TestWarpPerspective obj's underlying member method code with example usage: obj.test_exception(device, dtype) without return types