code: def test_matrix(self, device, dtype, batch_size):
      q = Quaternion.random(batch_size, device, dtype)
      r = So3(q).matrix()
      if batch_size is None:
          q = Quaternion(q.data[None])
          r = r[None]
      for i in range(r.shape[0]):
          q1 = q[i]
          r1 = r[i, :, :]
          pvec = torch.rand(3, device=device, dtype=dtype)
          pquat = Quaternion(
              torch.cat(
                  [torch.tensor([0], device=device, dtype=dtype), pvec]
              )
          )
          qp_ = q1 * pquat * q1.inv()
          rp_ = torch.matmul(r1, pvec)
          self.assert_close(rp_, qp_.vec)  # p_ = R*p = q*p*q_inv
          self.assert_close(rp_.norm(), pvec.norm())
  
imports: import pytest
  import torch
  from kornia.geometry.conversions import euler_from_quaternion
  from kornia.geometry.liegroup import So3
  from kornia.geometry.quaternion import Quaternion
  from kornia.geometry.vector import Vector3
  from kornia.testing import BaseTester
label_desc: Use image node_id 19 for calling the TestSo3 obj's underlying member method code with example usage: obj.test_matrix(device, dtype, batch_size) without return types