class_docstr: Base class to represent the So2 group.
  
  The SO(2) is the group of all rotations about the origin of two-dimensional Euclidean space
  :math:`R^2` under the operation of composition.
  See more: https://en.wikipedia.org/wiki/Orthogonal_group#Special_orthogonal_group
  
  We internally represent the rotation by a complex number.
  
  Example:
      >>> real = torch.tensor([1.0])
      >>> imag = torch.tensor([2.0])
      >>> So2(torch.complex(real, imag))
      Parameter containing:
      tensor([1.+2.j], requires_grad=True)
docstr: Create a So2 group representing a random rotation.
  
  Args:
      batch_size: the batch size of the underlying data.
  
  Example:
      >>> s = So2.random()
      >>> s = So2.random(batch_size=3)
docstr_tok: ["Create","a","So2","group","representing","a","random","rotation",".","Args",":","batch_size",":","the","batch","size","of","the","underlying","data",".","Example",":",">",">",">","s","=","So2.random","(",")",">",">",">","s","=","So2.random","(","batch_size=3",")"]
code: def random(
      cls,
      batch_size: Optional[int] = None,
      device: Optional[Device] = None,
      dtype: Optional[Dtype] = None,
  ) -> So2:
      """Create a So2 group representing a random rotation.
  
      Args:
          batch_size: the batch size of the underlying data.
  
      Example:
          >>> s = So2.random()
          >>> s = So2.random(batch_size=3)
      """
      if batch_size is not None:
          KORNIA_CHECK(
              batch_size >= 1, msg="batch_size must be positive"
          )
          real_data = rand((batch_size,), device=device, dtype=dtype)
          imag_data = rand((batch_size,), device=device, dtype=dtype)
      else:
          real_data = rand((), device=device, dtype=dtype)
          imag_data = rand((), device=device, dtype=dtype)
      return cls(complex(real_data, imag_data))
  
imports: from __future__ import annotations
  from typing import Optional, overload
  from kornia.core import Device, Dtype, Module, Parameter, Tensor, complex, rand, stack, tensor, zeros_like
  from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR
  from kornia.geometry.liegroup._utils import check_so2_matrix, check_so2_matrix_shape, check_so2_t_shape, check_so2_theta_shape, check_so2_z_shape
  from kornia.geometry.vector import Vector2
label_desc: Use image node_id 16 for calling the So2 obj's underlying member method code with example usage: obj.random(cls, batch_size, device, dtype) and returns: cls