class_docstr: Module, which performs optimization-based image registration.
  
  Args:
      model_type: Geometrical model for registration. Can be string or Module.
      optimizer: optimizer class used for the optimization.
      loss_fn: torch loss function.
      pyramid_levels: number of scale pyramid levels.
      lr: learning rate for optimization.
      num_iterations: maximum number of iterations.
      tolerance: stop optimizing if loss difference is less. default 1e-4.
      warper: if model_type is not string, one needs to provide warper object.
  
  Example:
      >>> from kornia.geometry import ImageRegistrator
      >>> img_src = torch.rand(1, 1, 32, 32)
      >>> img_dst = torch.rand(1, 1, 32, 32)
      >>> registrator = ImageRegistrator('similarity')
      >>> homo = registrator.register(img_src, img_dst)
code: def __init__(
      self,
      model_type: Union[str, BaseModel] = "homography",
      optimizer: Type[optim.Optimizer] = optim.Adam,
      loss_fn: Callable[..., Tensor] = F.l1_loss,
      pyramid_levels: int = 5,
      lr: float = 1e-3,
      num_iterations: int = 100,
      tolerance: float = 1e-4,
      warper: Optional[Type[BaseWarper]] = None,
  ) -> None:
      super().__init__()
      self.known_models = [
          "homography",
          "similarity",
          "translation",
          "scale",
          "rotation",
      ]
      # We provide pre-defined combinations or allow user to supply model
      # together with warper
      if not isinstance(model_type, str):
          if warper is None:
              raise ValueError(
                  "You must supply warper together with custom model"
              )
          self.warper = warper
          self.model = model_type
      elif model_type.lower() == "homography":
          self.warper = HomographyWarper
          self.model = Homography()
      elif model_type.lower() == "similarity":
          self.warper = HomographyWarper
          self.model = Similarity(True, True, True)
      elif model_type.lower() == "translation":
          self.warper = HomographyWarper
          self.model = Similarity(False, False, True)
      elif model_type.lower() == "rotation":
          self.warper = HomographyWarper
          self.model = Similarity(True, False, False)
      elif model_type.lower() == "scale":
          self.warper = HomographyWarper
          self.model = Similarity(False, True, False)
      else:
          raise ValueError(
              f"{model_type} is not supported. Try {self.known_models}"
          )
      self.pyramid_levels = pyramid_levels
      self.optimizer = optimizer
      self.lr = lr
      self.loss_fn = loss_fn
      self.num_iterations = num_iterations
      self.tolerance = tolerance
  
imports: from abc import abstractmethod
  from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
  import torch
  import torch.nn.functional
  from torch import nn, optim
  from kornia.core import Module, Tensor
  from kornia.geometry.conversions import angle_to_rotation_matrix, convert_affinematrix_to_homography
  from .homography_warper import BaseWarper, HomographyWarper
  from .pyramid import build_pyramid
label_desc: Use image node_id 1 to create a new ImageRegistrator object from inherited base classes: Module with example: obj = ImageRegistrator(model_type, optimizer, loss_fn, pyramid_levels, lr, num_iterations, tolerance, warper)