code: def test_forth_back(self, device, dtype):
      out_shape = (3, 4, 5)
      sample = torch.rand(2, 5, 3, 4, 5, device=device, dtype=dtype)
      P = torch.rand(2, 3, 4, device=device, dtype=dtype)
      P = kornia.geometry.convert_affinematrix_to_homography3d(P)
      P_hat = (_torch_inverse_cast(P) @ P)[:, :3]
      output = proj.warp_affine3d(
          sample, P_hat, out_shape, flags="nearest"
      )
      assert_close(output, sample, rtol=1e-4, atol=1e-4)
  
imports: import pytest
  import torch
  from torch.autograd import gradcheck
  import kornia
  import kornia.geometry.transform
  import kornia.testing
  from kornia.testing import assert_close
  from kornia.utils.helpers import _torch_inverse_cast
label_desc: Use image node_id 4 for calling the TestWarpAffine3d obj's underlying member method code with example usage: obj.test_forth_back(device, dtype) without return types