class_docstr: A Local Feature Transformer (LoFTR) module.
class_docstr_tok: ["A","Local","Feature","Transformer","(","LoFTR",")","module","."]
docstr: Args:
      feat0: [N, L, C]
      feat1: [N, S, C]
      mask0: [N, L] (optional)
      mask1: [N, S] (optional)
docstr_tok: ["Args",":","feat0",":","[","N",",","L",",","C","]","feat1",":","[","N",",","S",",","C","]","mask0",":","[","N",",","L","]","(","optional",")","mask1",":","[","N",",","S","]","(","optional",")"]
code: def forward(
      self,
      feat0: Tensor,
      feat1: Tensor,
      mask0: None | Tensor = None,
      mask1: None | Tensor = None,
  ) -> tuple[Tensor, Tensor]:
      """
      Args:
          feat0: [N, L, C]
          feat1: [N, S, C]
          mask0: [N, L] (optional)
          mask1: [N, S] (optional)
      """
      if self.d_model != feat0.size(2):
          msg = (
              "the feature number of src and transformer must be equal"
          )
          raise ValueError(msg)
  
      for layer, name in zip(self.layers, self.layer_names):
          if name == "self":
              feat0 = layer(feat0, feat0, mask0, mask0)
              feat1 = layer(feat1, feat1, mask1, mask1)
          elif name == "cross":
              feat0 = layer(feat0, feat1, mask0, mask1)
              feat1 = layer(feat1, feat0, mask1, mask0)
          else:
              raise KeyError
  
      return feat0, feat1
  
file_path: kornia/kornia/feature/loftr/loftr_module/transformer.py
imports: from __future__ import annotations
  import copy
  from typing import Any, Literal, Optional
  import torch
  from torch import nn
  from kornia.core import Module, Tensor
  from .linear_attention import FullAttention, LinearAttention
label_desc: Use image node_id 3 for calling the LocalFeatureTransformer obj's underlying member method code with example usage: obj.forward(feat0, feat1, mask0, mask1) and returns: feat0,  feat1