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)
docstr: Warp img_src into img_dst with transform_model and returns loss.
docstr_tok: ["Warp","img_src","into","img_dst","with","transform_model","and","returns","loss","."]
code: def get_single_level_loss(
      self, img_src: Tensor, img_dst: Tensor, transform_model: Tensor
  ) -> Tensor:
      """Warp img_src into img_dst with transform_model and returns loss."""
      # ToDo: Make possible registration of images of different shape
      if img_src.shape != img_dst.shape:
          raise ValueError(
              "Cannot register images of different shapes                             "
              f" {img_src.shape} {img_dst.shape:} "
          )
      _height, _width = img_dst.shape[-2:]
      warper = self.warper(_height, _width)
      img_src_to_dst = warper(img_src, transform_model)
      # compute and mask loss
      loss = self.loss_fn(
          img_src_to_dst, img_dst, reduction="none"
      )  # 1xCxHxW
      ones = warper(torch.ones_like(img_src), transform_model)
      loss = loss.masked_select(ones > 0.9).mean()
      return loss
  
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 2 for calling the ImageRegistrator obj's underlying member method code with example usage: obj.get_single_level_loss(img_src, img_dst, transform_model) and returns: loss