class_docstr: Sinusoidal positional encodings
  
  Using the scaling term from https://github.com/megvii-research/CREStereo/blob/master/nets/attention/position_encoding.py
  Reference implementation from https://github.com/facebookresearch/detr/blob/8a144f83a287f4d3fece4acdf073f387c5af387d/models/position_encoding.py#L28-L48
class_docstr_tok: ["Sinusoidal","positional","encodings","Using","the","scaling","term","from","https",":","\/\/github.com\/megvii-research\/CREStereo\/blob\/master\/nets\/attention\/position_encoding.py","Reference","implementation","from","https",":","\/\/github.com\/facebookresearch\/detr\/blob\/8a144f83a287f4d3fece4acdf073f387c5af387d\/models\/position_encoding.py","#","L28-L48"]
code: def __init__(self, dim_model: int, max_size: int = 256) -> None:
      super().__init__()
      self.dim_model = dim_model
      self.max_size = max_size
      # pre-registered for memory efficiency during forward pass
      pe = self._make_pe_of_size(self.max_size)
      self.register_buffer("pe", pe)
  
imports: import math
  from functools import partial
  from typing import Callable, Dict, Iterable, List, Optional, Tuple
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import torchvision.models.optical_flow.raft
  from torch import Tensor
  from torchvision.models._api import register_model, Weights, WeightsEnum
  from torchvision.models._utils import handle_legacy_interface
  from torchvision.models.optical_flow._utils import grid_sample, make_coords_grid, upsample_flow
  from torchvision.ops import Conv2dNormActivation
  from torchvision.prototype.transforms._presets import StereoMatching
label_desc: Use image node_id 1 to create a new PositionalEncodingSine object from inherited base classes: nn with example: obj = PositionalEncodingSine(dim_model, max_size)