class_docstr: This is a sinusoidal position encoding that generalized to 2-dimensional images.
docstr: Args:
      x: [N, C, H, W]
docstr_tok: ["Args",":","x",":","[","N",",","C",",","H",",","W","]"]
code: def forward(self, x: Tensor) -> Tensor:
      """
      Args:
          x: [N, C, H, W]
      """
      if x.size(2) > self.pe.size(2) or x.size(3) > self.pe.size(3):
          max_shape = (
              max(x.size(2), self.pe.size(2)),
              max(x.size(3), self.pe.size(3)),
          )
          self.update_position_encoding_size(max_shape)
  
      return x + self.pe[:, :, : x.size(2), : x.size(3)]
  
file_path: kornia/kornia/feature/loftr/utils/position_encoding.py
imports: import math
  from typing import Tuple
  import torch
  from kornia.core import Module, Tensor, cos, sin, zeros
label_desc: Use image node_id 4 for calling the PositionEncodingSine obj's underlying member method code with example usage: obj.forward(x) and returns: unknown