class_docstr: Module that computes gradient embedding, weighted by sqrt of magnitudes of given patches.
  
  Args:
      patch_size: Input patch size in pixels.
      relative: absolute or relative gradients.
  
  Returns:
      Gradient embedding.
  
  Shape:
      - Input: (B, 2, patch_size, patch_size)
      - Output: (B, 7, patch_size, patch_size)
  
  Examples:
      >>> grads = torch.rand(23, 2, 32, 32)
      >>> emb_grads = EmbedGradients(patch_size=32,
      ...                            relative=False)
      >>> emb = emb_grads(grads) # 23x7x32x32
class_docstr_tok: ["Module","that","computes","gradient","embedding",",","weighted","by","sqrt","of","magnitudes","of","given","patches",".","Args",":","patch_size",":","Input","patch","size","in","pixels",".","relative",":","absolute","or","relative","gradients",".","Returns",":","Gradient","embedding",".","Shape",":","-","Input",":","(","B",",","2",",","patch_size",",","patch_size",")","-","Output",":","(","B",",","7",",","patch_size",",","patch_size",")","Examples",":",">",">",">","grads","=","torch.rand","(","23",",","2",",","32",",","32",")",">",">",">","emb_grads","=","EmbedGradients","(","patch_size=32",",","...","relative=False",")",">",">",">","emb","=","emb_grads","(","grads",")","#","23x7x32x32"]
docstr: Embed square roots of magnitudes with eps for numerical reasons.
code: def emb_mags(self, mags: Tensor) -> Tensor:
      """Embed square roots of magnitudes with eps for numerical reasons."""
      mags = torch.sqrt(mags + self.eps)
      return mags
  
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 2 for calling the EmbedGradients obj's underlying member method code with example usage: obj.emb_mags(mags) and returns: mags