class_docstr: See: https://arxiv.org/pdf/1711.02508.pdf.
class_docstr_tok: ["See",":","https",":","\/\/arxiv.org\/pdf\/1711.02508.pdf","."]
code: def test_axis_angle_to_rotation_matrix(
      self, axis_name, device, dtype, atol, rtol
  ):
      # Random angle in [-pi..pi]
      angle = torch.tensor(
          (np.random.random(size=(2, 1)) * 2.0 * np.pi - np.pi),
          device=device,
          dtype=dtype,
      )
      (
          rot_m,
          axis,
      ) = TestAngleOfRotations.axis_and_angle_to_rotation_matrix(
          axis_name=axis_name, angle=angle, device=device, dtype=dtype
      )
      assert rot_m.dim() == 3
      assert rot_m.shape[-1] == 3
      assert rot_m.shape[-2] == 3
      assert rot_m.shape[-3] == angle.numel()
      assert axis.shape[-1] == 3
      assert axis.shape[-2] == angle.numel()
  
      # Make sure the returned axis matches the named one, and the appropriate column
      if axis_name == "x":
          assert_close(
              axis,
              torch.tensor(
                  ((1.0, 0.0, 0.0),) * angle.numel(),
                  device=device,
                  dtype=dtype,
              ),
          )
          assert_close(axis, rot_m[..., :3, 0])
      elif axis_name == "y":
          assert_close(
              axis,
              torch.tensor(
                  ((0.0, 1.0, 0.0),) * angle.numel(),
                  device=device,
                  dtype=dtype,
              ),
          )
          assert_close(axis, rot_m[..., :3, 1])
      elif axis_name == "z":
          assert_close(
              axis,
              torch.tensor(
                  ((0.0, 0.0, 1.0),) * angle.numel(),
                  device=device,
                  dtype=dtype,
              ),
          )
          assert_close(axis, rot_m[..., :3, 2])
      else:
          raise NotImplementedError(
              f"Not prepared for axis_name {axis_name}"
          )
  
      # Make sure axes are perpendicular
      zero = torch.zeros_like(angle).unsqueeze(-1)
      assert_close(
          rot_m[..., :3, 1:2].permute((0, 2, 1)) @ rot_m[..., :3, 0:1],
          zero,
          atol=atol,
          rtol=rtol,
      )
      assert_close(
          rot_m[..., :3, 2:3].permute((0, 2, 1)) @ rot_m[..., :3, 1:2],
          zero,
          atol=atol,
          rtol=rtol,
      )
      assert_close(
          rot_m[..., :3, 2:3].permute((0, 2, 1)) @ rot_m[..., :3, 0:1],
          zero,
          atol=atol,
          rtol=rtol,
      )
  
      # Make sure axes are unit norm
      one = torch.ones_like(angle)
      assert_close(
          rot_m[..., :3, 0].norm(p=2, dim=-1, keepdim=True),
          one,
          atol=atol,
          rtol=rtol,
      )
      assert_close(
          rot_m[..., :3, 1].norm(p=2, dim=-1, keepdim=True),
          one,
          atol=atol,
          rtol=rtol,
      )
      assert_close(
          rot_m[..., :3, 2].norm(p=2, dim=-1, keepdim=True),
          one,
          atol=atol,
          rtol=rtol,
      )
  
imports: import numpy
  import pytest
  import torch
  import kornia
  from kornia.testing import assert_close
label_desc: Use image node_id 3 for calling the TestAngleOfRotations obj's underlying member method code with example usage: obj.test_axis_angle_to_rotation_matrix(axis_name, device, dtype, atol, rtol) without return types