code: def test_translation(self, device, dtype):
      offset = 1.0
      h, w = 3, 4
      aff_ab = torch.eye(2, 3, device=device, dtype=dtype)[None]
      aff_ab[..., -1] += offset
  
      img_b = torch.arange(
          float(h * w), device=device, dtype=dtype
      ).view(1, 1, h, w)
  
      expected = torch.zeros_like(img_b)
      expected[..., 1:, 1:] = img_b[..., :2, :3]
  
      # Same as opencv: cv2.warpAffine(kornia.tensor_to_image(img_b), aff_ab[0].numpy(), (w, h))
      img_a = kornia.geometry.warp_affine(img_b, aff_ab, (h, w))
      assert_close(img_a, expected)
  
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 4 for calling the TestWarpAffine obj's underlying member method code with example usage: obj.test_translation(device, dtype) without return types