code: def test_forward_3d(self):
      x = torch.rand(2, 1, 4, 4, 4)
      theta = torch.Tensor(
          [[[0, 0, -1, 0], [1, 0, 0, 0], [0, 0, 1, 0]]]
      ).repeat(2, 1, 1)
      grid = torch.nn.functional.affine_grid(
          theta, x.size(), align_corners=False
      )
      expected = torch.nn.functional.grid_sample(
          x, grid, align_corners=False
      )
      expected = expected.detach().cpu().numpy()
  
      actual = AffineTransform(
          normalized=True, reverse_indexing=False, align_corners=False
      )(x, theta)
      actual = actual.detach().cpu().numpy()
      np.testing.assert_allclose(actual, expected)
      np.testing.assert_allclose(list(theta.shape), [2, 3, 4])
  
      theta = torch.Tensor([[0, 0, -1, 0], [1, 0, 0, 0], [0, 0, 1, 0]])
      actual = AffineTransform(
          normalized=True, reverse_indexing=False, align_corners=False
      )(x, theta)
      actual = actual.detach().cpu().numpy()
      np.testing.assert_allclose(actual, expected)
      np.testing.assert_allclose(list(theta.shape), [3, 4])
  
      theta = torch.Tensor(
          [[[0, 0, -1, 0], [1, 0, 0, 0], [0, 0, 1, 0]]]
      )
      actual = AffineTransform(
          normalized=True, reverse_indexing=False, align_corners=False
      )(x, theta)
      actual = actual.detach().cpu().numpy()
      np.testing.assert_allclose(actual, expected)
      np.testing.assert_allclose(list(theta.shape), [1, 3, 4])
  
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  from parameterized import parameterized
  from monai.networks import normalize_transform, to_norm_affine
  from monai.networks.layers import AffineTransform
  from tests.utils import is_tf32_env
label_desc: Use image node_id 13 for calling the TestAffineTransform obj's underlying member method code with example usage: obj.test_forward_3d() without return types