class_docstr: Base encoder for FeatureEncoder and ContextEncoder in which weight may be shared.
  
  See the Raft-Stereo paper section 4.6 on backbone part.
class_docstr_tok: ["Base","encoder","for","FeatureEncoder","and","ContextEncoder","in","which","weight","may","be","shared",".","See","the","Raft-Stereo","paper","section","4.6","on","backbone","part","."]
code: def __init__(
      self,
      *,
      block: Callable[..., nn.Module] = ResidualBlock,
      layers: Tuple[int, int, int, int] = (64, 64, 96, 128),
      strides: Tuple[int, int, int, int] = (2, 1, 2, 2),
      norm_layer: Callable[..., nn.Module] = nn.BatchNorm2d,
  ):
      # We use layers + (256,) because raft.FeatureEncoder require 5 layers
      # but here we will set the last conv layer to identity
      super().__init__(
          block=block,
          layers=layers + (256,),
          strides=strides,
          norm_layer=norm_layer,
      )
  
      # Base encoder don't have the last conv layer of feature encoder
      self.conv = nn.Identity()
  
      self.output_dim = layers[3]
      num_downsampling = sum([x - 1 for x in strides])
      self.downsampling_ratio = 2 ** (num_downsampling)
  
imports: from functools import partial
  from typing import Callable, List, Optional, Tuple
  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.models.optical_flow.raft import FlowHead, MotionEncoder, ResidualBlock
  from torchvision.ops import Conv2dNormActivation
  from torchvision.prototype.transforms._presets import StereoMatching
  from torchvision.utils import _log_api_usage_once
label_desc: Use image node_id 1 to create a new BaseEncoder object from inherited base classes: raft with example: obj = BaseEncoder()