class_docstr: Module which detects and described local features in an image using the DISK method. See
  :cite:`tyszkiewicz2020disk` for details.
  
  .. image:: _static/img/disk_outdoor_depth.jpg
  
  Args:
      desc_dim: The dimension of the descriptor.
      unet: The U-Net to use. If None, a default U-Net is used. Kornia doesn't provide the training code for DISK
            so this is only useful when using a custom checkpoint trained using the code released with the paper.
            The unet should take as input a tensor of shape :math:`(B, C, H, W)` and output a tensor of shape
            :math:`(B, \mathrm{desc\_dim} + 1, H, W)`.
  
  Example:
      >>> disk = DISK.from_pretrained('depth')
      >>> images = torch.rand(1, 3, 256, 256)
      >>> features = disk(images)
class_docstr_tok: ["Module","which","detects","and","described","local","features","in","an","image","using","the","DISK","method",".","See",":","cite",":","`","tyszkiewicz2020disk","`","for","details",".","..","image",":",":","_static\/img\/disk_outdoor_depth.jpg","Args",":","desc_dim",":","The","dimension","of","the","descriptor",".","unet",":","The","U-Net","to","use",".","If","None",",","a","default","U-Net","is","used",".","Kornia","does","n't","provide","the","training","code","for","DISK","so","this","is","only","useful","when","using","a","custom","checkpoint","trained","using","the","code","released","with","the","paper",".","The","unet","should","take","as","input","a","tensor","of","shape",":","math",":","`","(","B",",","C",",","H",",","W",")","`","and","output","a","tensor","of","shape",":","math",":","`","(","B",",","\\mathrm","{","desc\\_dim","}","+","1",",","H",",","W",")","`",".","Example",":",">",">",">","disk","=","DISK.from_pretrained","(","'depth","'",")",">",">",">","images","=","torch.rand","(","1",",","3",",","256",",","256",")",">",">",">","features","=","disk","(","images",")"]
docstr: Loads a pretrained model.
  
  Depth model was trained using depth map supervision and is slightly more precise but biased to detect keypoints
  only where SfM depth is available. Epipolar model was trained using epipolar geometry supervision and
  is less precise but detects keypoints everywhere where they are matchable. The difference is especially
  pronounced on thin structures and on edges of objects.
  
  Args:
      checkpoint: The checkpoint to load. One of 'depth' or 'epipolar'.
      device: The device to load the model to.
  
  Returns:
      The pretrained model.
docstr_tok: ["Loads","a","pretrained","model",".","Depth","model","was","trained","using","depth","map","supervision","and","is","slightly","more","precise","but","biased","to","detect","keypoints","only","where","SfM","depth","is","available",".","Epipolar","model","was","trained","using","epipolar","geometry","supervision","and","is","less","precise","but","detects","keypoints","everywhere","where","they","are","matchable",".","The","difference","is","especially","pronounced","on","thin","structures","and","on","edges","of","objects",".","Args",":","checkpoint",":","The","checkpoint","to","load",".","One","of","'depth","'","or","'epipolar","'",".","device",":","The","device","to","load","the","model","to",".","Returns",":","The","pretrained","model","."]
code: def from_pretrained(
      cls,
      checkpoint: str = "depth",
      device: torch.device = torch.device("cpu"),
  ) -> DISK:
      r"""Loads a pretrained model.
  
      Depth model was trained using depth map supervision and is slightly more precise but biased to detect keypoints
      only where SfM depth is available. Epipolar model was trained using epipolar geometry supervision and
      is less precise but detects keypoints everywhere where they are matchable. The difference is especially
      pronounced on thin structures and on edges of objects.
  
      Args:
          checkpoint: The checkpoint to load. One of 'depth' or 'epipolar'.
          device: The device to load the model to.
  
      Returns:
          The pretrained model.
      """
      urls = {
          "depth": "https://raw.githubusercontent.com/cvlab-epfl/disk/master/depth-save.pth",
          "epipolar": "https://raw.githubusercontent.com/cvlab-epfl/disk/master/epipolar-save.pth",
      }
  
      if checkpoint not in urls:
          raise ValueError(f"Unknown pretrained model: {checkpoint}")
  
      pretrained_dict = torch.hub.load_state_dict_from_url(
          urls[checkpoint], map_location=device
      )
  
      model: DISK = cls().to(device)
      model.load_state_dict(pretrained_dict["extractor"])
      model.eval()
      return model
  
file_path: kornia/kornia/feature/disk/disk.py
imports: from __future__ import annotations
  from typing import Optional
  import torch
  from kornia.core import Module, Tensor
  from ._unets import Unet
  from .detector import heatmap_to_keypoints
  from .structs import DISKFeatures
label_desc: Use image node_id 4 for calling the DISK obj's underlying member method code with example usage: obj.from_pretrained(cls, checkpoint, device) and returns: model