class_docstr: Module that finds edges of the input image and filters them using the Canny algorithm.
  
  Args:
      input: input image tensor with shape :math:`(B,C,H,W)`.
      low_threshold: lower threshold for the hysteresis procedure.
      high_threshold: upper threshold for the hysteresis procedure.
      kernel_size: the size of the kernel for the gaussian blur.
      sigma: the standard deviation of the kernel for the gaussian blur.
      hysteresis: if True, applies the hysteresis edge tracking.
          Otherwise, the edges are divided between weak (0.5) and strong (1) edges.
      eps: regularization number to avoid NaN during backprop.
  
  Returns:
      - the canny edge magnitudes map, shape of :math:`(B,1,H,W)`.
      - the canny edge detection filtered by thresholds and hysteresis, shape of :math:`(B,1,H,W)`.
  
  Example:
      >>> input = torch.rand(5, 3, 4, 4)
      >>> magnitude, edges = Canny()(input)  # 5x3x4x4
      >>> magnitude.shape
      torch.Size([5, 1, 4, 4])
      >>> edges.shape
      torch.Size([5, 1, 4, 4])
class_docstr_tok: ["Module","that","finds","edges","of","the","input","image","and","filters","them","using","the","Canny","algorithm",".","Args",":","input",":","input","image","tensor","with","shape",":","math",":","`","(","B",",","C",",","H",",","W",")","`",".","low_threshold",":","lower","threshold","for","the","hysteresis","procedure",".","high_threshold",":","upper","threshold","for","the","hysteresis","procedure",".","kernel_size",":","the","size","of","the","kernel","for","the","gaussian","blur",".","sigma",":","the","standard","deviation","of","the","kernel","for","the","gaussian","blur",".","hysteresis",":","if","True",",","applies","the","hysteresis","edge","tracking",".","Otherwise",",","the","edges","are","divided","between","weak","(","0.5",")","and","strong","(","1",")","edges",".","eps",":","regularization","number","to","avoid","NaN","during","backprop",".","Returns",":","-","the","canny","edge","magnitudes","map",",","shape","of",":","math",":","`","(","B,1",",","H",",","W",")","`",".","-","the","canny","edge","detection","filtered","by","thresholds","and","hysteresis",",","shape","of",":","math",":","`","(","B,1",",","H",",","W",")","`",".","Example",":",">",">",">","input","=","torch.rand","(","5",",","3",",","4",",","4",")",">",">",">","magnitude",",","edges","=","Canny","(",")","(","input",")","#","5x3x4x4",">",">",">","magnitude.shape","torch.Size","(","[","5",",","1",",","4",",","4","]",")",">",">",">","edges.shape","torch.Size","(","[","5",",","1",",","4",",","4","]",")"]
code: def forward(self, input: Tensor) -> tuple[Tensor, Tensor]:
      return canny(
          input,
          self.low_threshold,
          self.high_threshold,
          self.kernel_size,
          self.sigma,
          self.hysteresis,
          self.eps,
      )
  
file_path: kornia/kornia/filters/canny.py
imports: from __future__ import annotations
  import math
  import torch
  import torch.nn.functional
  from kornia.color import rgb_to_grayscale
  from kornia.core import Module, Tensor
  from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR, KORNIA_CHECK_SHAPE
  from .gaussian import gaussian_blur2d
  from .kernels import get_canny_nms_kernel, get_hysteresis_kernel
  from .sobel import spatial_gradient
label_desc: Use image node_id 3 for calling the Canny obj's underlying member method code with example usage: obj.forward(input) and returns: canny