class_docstr: Module, which computes parameters of Von Mises kernel given coefficients, and embeds given patches.
  
  Args:
      patch_size: Input patch size in pixels.
      coeffs: List of coefficients. Some examples are hardcoded in COEFFS,
  
  Returns:
      Von Mises embedding of given parametrization.
  
  Shape:
      - Input: (B, 1, patch_size, patch_size)
      - Output: (B, d, patch_size, patch_size)
  
  Examples:
      >>> oris = torch.rand(23, 1, 32, 32)
      >>> vm = VonMisesKernel(patch_size=32,
      ...                     coeffs=[0.14343168,
      ...                             0.268285,
      ...                             0.21979234])
      >>> emb = vm(oris) # 23x7x32x32
class_docstr_tok: ["Module",",","which","computes","parameters","of","Von","Mises","kernel","given","coefficients",",","and","embeds","given","patches",".","Args",":","patch_size",":","Input","patch","size","in","pixels",".","coeffs",":","List","of","coefficients",".","Some","examples","are","hardcoded","in","COEFFS",",","Returns",":","Von","Mises","embedding","of","given","parametrization",".","Shape",":","-","Input",":","(","B",",","1",",","patch_size",",","patch_size",")","-","Output",":","(","B",",","d",",","patch_size",",","patch_size",")","Examples",":",">",">",">","oris","=","torch.rand","(","23",",","1",",","32",",","32",")",">",">",">","vm","=","VonMisesKernel","(","patch_size=32",",","...","coeffs=","[","0.14343168",",","...","0.268285",",","...","0.21979234","]",")",">",">",">","emb","=","vm","(","oris",")","#","23x7x32x32"]
code: def __init__(
      self,
      patch_size: int,
      coeffs: Union[
          List[Union[float, int]], Tuple[Union[float, int], ...]
      ],
  ) -> None:
      super().__init__()
  
      self.patch_size = patch_size
      b_coeffs = tensor(coeffs)
      self.register_buffer("coeffs", b_coeffs)
  
      # Compute parameters.
      n = len(coeffs) - 1
      self.n = n
      self.d = 2 * n + 1
  
      # Precompute helper variables.
      emb0 = torch.ones([1, 1, patch_size, patch_size])
      frange = torch.arange(n) + 1
      frange = frange.reshape(-1, 1, 1)
      weights = zeros([2 * n + 1])
      weights[: n + 1] = torch.sqrt(b_coeffs)
      weights[n + 1 :] = torch.sqrt(b_coeffs[1:])
      weights = weights.reshape(-1, 1, 1)
      self.register_buffer("emb0", emb0)
      self.register_buffer("frange", frange)
      self.register_buffer("weights", weights)
  
imports: from typing import Any, Dict, List, Tuple, Union
  import torch
  import torch.nn.functional
  from torch import nn
  from kornia.constants import pi
  from kornia.core import Tensor, cos, sin, tensor, zeros
  from kornia.filters import GaussianBlur2d, SpatialGradient
  from kornia.geometry.conversions import cart2pol
  from kornia.utils import create_meshgrid
  from kornia.utils.helpers import map_location_to_cpu
label_desc: Use image node_id 1 to create a new VonMisesKernel object from inherited base classes: nn with example: obj = VonMisesKernel(patch_size, coeffs)