docstr: To get parameters:
  import torchvision as tv
  from PIL import Image
  from torch import Tensor as T
  import math
  import random
  img_size = (96,96)
  seed = 42
  torch.manual_seed(seed)
  torch.cuda.manual_seed(seed)
  torch.cuda.manual_seed_all(seed)  # if you are using multi-GPU.
  np.random.seed(seed)  # Numpy module.
  random.seed(seed)  # Python random module.
  torch.manual_seed(seed)
  tfm = tv.transforms.RandomAffine(degrees=(-25.0,25.0),
                                  scale=(0.6, 1.4) ,
                                  translate=(0, 0.1),
                                  shear=(-25., 25., -20., 20.))
  angle, translations, scale, shear = tfm.get_params(tfm.degrees, tfm.translate,
                                                  tfm.scale, tfm.shear, img_size)
  print (angle, translations, scale, shear)
  output_size = img_size
  center = (img.size[0] * 0.5 + 0.5, img.size[1] * 0.5 + 0.5)
  
  matrix = tv.transforms.functional._get_inverse_affine_matrix(center, angle, translations, scale, shear)
  matrix = np.array(matrix).reshape(2,3)
  print (matrix)
code: def test_compose_affine_matrix_3x3(self, device, dtype):
      """To get parameters:
      import torchvision as tv
      from PIL import Image
      from torch import Tensor as T
      import math
      import random
      img_size = (96,96)
      seed = 42
      torch.manual_seed(seed)
      torch.cuda.manual_seed(seed)
      torch.cuda.manual_seed_all(seed)  # if you are using multi-GPU.
      np.random.seed(seed)  # Numpy module.
      random.seed(seed)  # Python random module.
      torch.manual_seed(seed)
      tfm = tv.transforms.RandomAffine(degrees=(-25.0,25.0),
                                      scale=(0.6, 1.4) ,
                                      translate=(0, 0.1),
                                      shear=(-25., 25., -20., 20.))
      angle, translations, scale, shear = tfm.get_params(tfm.degrees, tfm.translate,
                                                      tfm.scale, tfm.shear, img_size)
      print (angle, translations, scale, shear)
      output_size = img_size
      center = (img.size[0] * 0.5 + 0.5, img.size[1] * 0.5 + 0.5)
  
      matrix = tv.transforms.functional._get_inverse_affine_matrix(center, angle, translations, scale, shear)
      matrix = np.array(matrix).reshape(2,3)
      print (matrix)
      """
      import math
  
      from torch import Tensor as T
  
      batch_size, _, height, width = 1, 1, 96, 96
      angle, translations = 6.971339922894188, (0.0, -4.0)
      scale, shear = [0.7785685905190581, 0.7785685905190581], [
          11.8235607082617,
          7.06797949691645,
      ]
      matrix_expected = T(
          [
              [1.27536969, 4.26828945e-01, -3.2349e01],
              [2.18297196e-03, 1.29424165e00, -9.1996e00],
          ]
      )
      center = T([float(width), float(height)]).view(1, 2) / 2.0 + 0.5
      center = center.expand(batch_size, -1)
      matrix_kornia = kornia.geometry.transform.get_affine_matrix2d(
          T(translations).view(-1, 2),
          center,
          T([scale]).view(-1, 2),
          T([angle]).view(-1),
          T([math.radians(shear[0])]).view(-1, 1),
          T([math.radians(shear[1])]).view(-1, 1),
      )
      matrix_kornia = matrix_kornia.inverse()[0, :2].detach().cpu()
      assert_close(matrix_kornia, matrix_expected, atol=1e-4, rtol=1e-4)
  
imports: import pytest
  import torch
  from torch.autograd import gradcheck
  import kornia
  import kornia.testing
  from kornia.testing import assert_close
label_desc: Use image node_id 8 for calling the TestAffine2d obj's underlying member method code with example usage: obj.test_compose_affine_matrix_3x3(device, dtype) without return types