code: def crestereo_base(
      *,
      weights: Optional[CREStereo_Base_Weights] = None,
      progress=True,
      **kwargs,
  ) -> CREStereo:
      """CREStereo model from
      `Practical Stereo Matching via Cascaded Recurrent Network
      With Adaptive Correlation <https://openaccess.thecvf.com/content/CVPR2022/papers/Li_Practical_Stereo_Matching_via_Cascaded_Recurrent_Network_With_Adaptive_Correlation_CVPR_2022_paper.pdf>`_.
  
      Please see the example below for a tutorial on how to use this model.
  
      Args:
          weights(:class:`~torchvision.prototype.models.depth.stereo.CREStereo_Base_Weights`, optional): The
              pretrained weights to use. See
              :class:`~torchvision.prototype.models.depth.stereo.CREStereo_Base_Weights`
              below for more details, and possible values. By default, no
              pre-trained weights are used.
          progress (bool): If True, displays a progress bar of the download to stderr. Default is True.
          **kwargs: parameters passed to the ``torchvision.prototype.models.depth.stereo.raft_stereo.RaftStereo``
              base class. Please refer to the `source code
              <https://github.com/pytorch/vision/blob/main/torchvision/models/optical_flow/crestereo.py>`_
              for more details about this class.
  
      .. autoclass:: torchvision.prototype.models.depth.stereo.CREStereo_Base_Weights
          :members:
      """
  
      weights = CREStereo_Base_Weights.verify(weights)
  
      return _crestereo(
          weights=weights,
          progress=progress,
          # Feature encoder
          feature_encoder_layers=(64, 64, 96, 128, 256),
          feature_encoder_strides=(2, 1, 2, 1),
          feature_encoder_block=partial(
              raft.ResidualBlock, always_project=True
          ),
          feature_encoder_norm_layer=nn.InstanceNorm2d,
          # Average pooling pyramid
          feature_downsample_rates=(2, 4),
          # Motion encoder
          motion_encoder_corr_layers=(256, 192),
          motion_encoder_flow_layers=(128, 64),
          motion_encoder_out_channels=128,
          # Recurrent block
          recurrent_block_hidden_state_size=128,
          recurrent_block_kernel_size=((1, 5), (5, 1)),
          recurrent_block_padding=((0, 2), (2, 0)),
          # Flow head
          flow_head_hidden_size=256,
          # Transformer blocks
          num_attention_heads=8,
          num_self_attention_layers=1,
          num_cross_attention_layers=1,
          self_attention_module=LinearAttention,
          cross_attention_module=LinearAttention,
          # Adaptive Correlation layer
          corr_groups=4,
          corr_search_window_2d=(3, 3),
          corr_search_dilate_2d=(1, 1),
          corr_search_window_1d=(1, 9),
          corr_search_dilate_1d=(1, 1),
      )
  
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 5 for calling a global function with example usage: crestereo_base() and returns: _crestereo