class_docstr: Base class to represent the So3 group.
  
  The SO(3) is the group of all rotations about the origin of three-dimensional Euclidean space
  :math:`R^3` under the operation of composition.
  See more: https://en.wikipedia.org/wiki/3D_rotation_group
  
  We internally represent the rotation by a unit quaternion.
  
  Example:
      >>> q = Quaternion.identity()
      >>> s = So3(q)
      >>> s.q
      Parameter containing:
      tensor([1., 0., 0., 0.], requires_grad=True)
class_docstr_tok: ["Base","class","to","represent","the","So3","group",".","The","SO","(","3",")","is","the","group","of","all","rotations","about","the","origin","of","three-dimensional","Euclidean","space",":","math",":","`","R^3","`","under","the","operation","of","composition",".","See","more",":","https",":","\/\/en.wikipedia.org\/wiki\/3D_rotation_group","We","internally","represent","the","rotation","by","a","unit","quaternion",".","Example",":",">",">",">","q","=","Quaternion.identity","(",")",">",">",">","s","=","So3","(","q",")",">",">",">","s.q","Parameter","containing",":","tensor","(","[","1.",",","0.",",","0.",",","0",".","]",",","requires_grad=True",")"]
docstr: Convert the quaternion to a rotation matrix of shape :math:`(B,3,3)`.
  
  The matrix is of the form:
  
  .. math::
      \begin{bmatrix} 1-2y^2-2z^2 & 2xy-2zw & 2xy+2yw \\
      2xy+2zw & 1-2x^2-2z^2 & 2yz-2xw \\
      2xz-2yw & 2yz+2xw & 1-2x^2-2y^2\end{bmatrix}
  
  Example:
      >>> s = So3.identity()
      >>> m = s.matrix()
      >>> m
      tensor([[1., 0., 0.],
              [0., 1., 0.],
              [0., 0., 1.]], grad_fn=<StackBackward0>)
docstr_tok: ["Convert","the","quaternion","to","a","rotation","matrix","of","shape",":","math",":","`","(","B,3,3",")","`",".","The","matrix","is","of","the","form",":","..","math",":",":","\\begin","{","bmatrix","}","1-2y^2-2z^2","&","2xy-2zw","&","2xy+2yw","\\\\","2xy+2zw","&","1-2x^2-2z^2","&","2yz-2xw","\\\\","2xz-2yw","&","2yz+2xw","&","1-2x^2-2y^2\\end","{","bmatrix","}","Example",":",">",">",">","s","=","So3.identity","(",")",">",">",">","m","=","s.matrix","(",")",">",">",">","m","tensor","(","[","[","1.",",","0.",",","0",".","]",",","[","0.",",","1.",",","0",".","]",",","[","0.",",","0.",",","1",".","]","]",",","grad_fn=","<","StackBackward0",">",")"]
code: def matrix(self) -> Tensor:
      r"""Convert the quaternion to a rotation matrix of shape :math:`(B,3,3)`.
  
          The matrix is of the form:
  
          .. math::
              \begin{bmatrix} 1-2y^2-2z^2 & 2xy-2zw & 2xy+2yw \\
              2xy+2zw & 1-2x^2-2z^2 & 2yz-2xw \\
              2xz-2yw & 2yz+2xw & 1-2x^2-2y^2\end{bmatrix}
  
          Example:
              >>> s = So3.identity()
              >>> m = s.matrix()
              >>> m
              tensor([[1., 0., 0.],
                      [0., 1., 0.],
                      [0., 0., 1.]], grad_fn=<StackBackward0>)
          """
      w = self.q.w[..., None]
      x, y, z = (
          self.q.x[..., None],
          self.q.y[..., None],
          self.q.z[..., None],
      )
      q0 = 1 - 2 * y**2 - 2 * z**2
      q1 = 2 * x * y - 2 * z * w
      q2 = 2 * x * z + 2 * y * w
      row0 = concatenate((q0, q1, q2), -1)
      q0 = 2 * x * y + 2 * z * w
      q1 = 1 - 2 * x**2 - 2 * z**2
      q2 = 2 * y * z - 2 * x * w
      row1 = concatenate((q0, q1, q2), -1)
      q0 = 2 * x * z - 2 * y * w
      q1 = 2 * y * z + 2 * x * w
      q2 = 1 - 2 * x**2 - 2 * y**2
      row2 = concatenate((q0, q1, q2), -1)
      return stack((row0, row1, row2), -2)
  
imports: from __future__ import annotations
  from typing import Optional
  from kornia.core import Device, Dtype, Module, Tensor, concatenate, eye, stack, tensor, where, zeros, zeros_like
  from kornia.core.check import KORNIA_CHECK_TYPE
  from kornia.geometry.conversions import vector_to_skew_symmetric_matrix
  from kornia.geometry.linalg import batched_dot_product
  from kornia.geometry.quaternion import Quaternion
  from kornia.geometry.vector import Vector3
label_desc: Use image node_id 10 for calling the So3 obj's underlying member method code with example usage: obj.matrix() and returns: stack