code: def test_rotation_inverse(self, device, dtype):
      h, w = 4, 4
      img_b = torch.rand(1, 1, h, w, device=device, dtype=dtype)
  
      # create rotation matrix of 90deg (anti-clockwise)
      center = (
          torch.tensor([[w - 1, h - 1]], device=device, dtype=dtype) / 2
      )
      scale = torch.ones((1, 2), device=device, dtype=dtype)
      angle = 90.0 * torch.ones(1, device=device, dtype=dtype)
      aff_ab = kornia.geometry.get_rotation_matrix2d(
          center, angle, scale
      )
      # Same as opencv: cv2.getRotationMatrix2D(((w-1)/2,(h-1)/2), 90., 1.)
  
      H_ab = kornia.geometry.convert_affinematrix_to_homography(
          aff_ab
      )  # Bx3x3
  
      # warp the tensor
      # Same as opencv: cv2.warpPerspecive(kornia.tensor_to_image(img_b), H_ab[0].numpy(), (w, h))
      img_a = kornia.geometry.warp_perspective(img_b, H_ab, (h, w))
  
      # invert the transform
      H_ba = _torch_inverse_cast(H_ab)
      img_b_hat = kornia.geometry.warp_perspective(img_a, H_ba, (h, w))
      assert_close(img_b_hat, img_b, rtol=1e-4, atol=1e-4)
  
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 6 for calling the TestWarpPerspective obj's underlying member method code with example usage: obj.test_rotation_inverse(device, dtype) without return types