class_docstr: See: https://arxiv.org/pdf/1711.02508.pdf.
class_docstr_tok: ["See",":","https",":","\/\/arxiv.org\/pdf\/1711.02508.pdf","."]
code: def test_log_quaternion(
      self, axis_name, angle_deg, device, dtype, atol, rtol
  ):
      eps = torch.finfo(dtype).eps
      angle = (
          (angle_deg * kornia.pi / 180.0)
          .to(dtype)
          .to(device)
          .repeat(2, 1)
      )
      pi = torch.ones_like(angle) * kornia.pi
      (
          rot_m,
          axis,
      ) = TestAngleOfRotations.axis_and_angle_to_rotation_matrix(
          axis_name=axis_name, angle=angle, device=device, dtype=dtype
      )
      quaternion = (
          kornia.geometry.conversions.rotation_matrix_to_quaternion(
              rot_m, eps=eps
          )
      )
      log_q = kornia.geometry.conversions.quaternion_exp_to_log(
          quaternion, eps=eps
      )
      # compute axis_angle rotation angle
      angle_hat = 2.0 * log_q.norm(p=2, dim=-1, keepdim=True)
      # make sure it lands between [-pi..pi)
      mask = pi < angle_hat
      while torch.any(mask):
          angle_hat = torch.where(
              mask, angle_hat - 2.0 * kornia.pi, angle_hat
          )
          mask = pi < angle_hat
      # invert angle, if axis_angle axis points in the opposite direction of the original axis
      dots = (log_q * axis).sum(dim=-1, keepdim=True)
      angle_hat = torch.where(dots < 0.0, angle_hat * -1.0, angle_hat)
      # axis_angle angle should match input angle
      assert_close(angle_hat, angle, atol=atol, rtol=rtol)
      # magnitude of angle should match matrix rotation angle
      matrix_angle_abs = TestAngleOfRotations.matrix_angle_abs(rot_m)
      assert_close(
          torch.abs(angle_hat), matrix_angle_abs, 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 7 for calling the TestAngleOfRotations obj's underlying member method code with example usage: obj.test_log_quaternion(axis_name, angle_deg, device, dtype, atol, rtol) without return types