class_docstr: Implements CREStereo from the `"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>`_ paper.
  Args:
      feature_encoder (raft.FeatureEncoder): Raft-like Feature Encoder module extract low-level features from inputs.
      update_block (raft.UpdateBlock): Raft-like Update Block which recursively refines a flow-map.
      flow_head (raft.FlowHead): Raft-like Flow Head which predics a flow-map from some inputs.
      self_attn_block (LocalFeatureTransformer): A Local Feature Transformer that performs self attention on the two feature maps.
      cross_attn_block (LocalFeatureTransformer): A Local Feature Transformer that performs cross attention between the two feature maps
          used in the Adaptive Group Correlation module.
      feature_downsample_rates (List[int]): The downsample rates used to build a feature pyramid from the outputs of the `feature_encoder`. Default: [2, 4]
      correlation_groups (int): In how many groups should the features be split when computer per-pixel correlation. Defaults 4.
      search_window_1d (Tuple[int, int]): The alternate search window size in the x and y directions for the 1D case. Defaults to (1, 9).
      search_dilate_1d (Tuple[int, int]): The dilation used in the `search_window_1d` when selecting pixels. Similar to `nn.Conv2d` dilate. Defaults to (1, 1).
      search_window_2d (Tuple[int, int]): The alternate search window size in the x and y directions for the 2D case. Defaults to (3, 3).
      search_dilate_2d (Tuple[int, int]): The dilation used in the `search_window_2d` when selecting pixels. Similar to `nn.Conv2d` dilate. Defaults to (1, 1).
class_docstr_tok: ["Implements","CREStereo","from","the","`","``","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",">","`","_","paper",".","Args",":","feature_encoder","(","raft.FeatureEncoder",")",":","Raft-like","Feature","Encoder","module","extract","low-level","features","from","inputs",".","update_block","(","raft.UpdateBlock",")",":","Raft-like","Update","Block","which","recursively","refines","a","flow-map",".","flow_head","(","raft.FlowHead",")",":","Raft-like","Flow","Head","which","predics","a","flow-map","from","some","inputs",".","self_attn_block","(","LocalFeatureTransformer",")",":","A","Local","Feature","Transformer","that","performs","self","attention","on","the","two","feature","maps",".","cross_attn_block","(","LocalFeatureTransformer",")",":","A","Local","Feature","Transformer","that","performs","cross","attention","between","the","two","feature","maps","used","in","the","Adaptive","Group","Correlation","module",".","feature_downsample_rates","(","List","[","int","]",")",":","The","downsample","rates","used","to","build","a","feature","pyramid","from","the","outputs","of","the","`","feature_encoder","`",".","Default",":","[","2",",","4","]","correlation_groups","(","int",")",":","In","how","many","groups","should","the","features","be","split","when","computer","per-pixel","correlation",".","Defaults","4.","search_window_1d","(","Tuple","[","int",",","int","]",")",":","The","alternate","search","window","size","in","the","x","and","y","directions","for","the","1D","case",".","Defaults","to","(","1",",","9",")",".","search_dilate_1d","(","Tuple","[","int",",","int","]",")",":","The","dilation","used","in","the","`","search_window_1d","`","when","selecting","pixels",".","Similar","to","`","nn.Conv2d","`","dilate",".","Defaults","to","(","1",",","1",")",".","search_window_2d","(","Tuple","[","int",",","int","]",")",":","The","alternate","search","window","size","in","the","x","and","y","directions","for","the","2D","case",".","Defaults","to","(","3",",","3",")",".","search_dilate_2d","(","Tuple","[","int",",","int","]",")",":","The","dilation","used","in","the","`","search_window_2d","`","when","selecting","pixels",".","Similar","to","`","nn.Conv2d","`","dilate",".","Defaults","to","(","1",",","1",")","."]
code: def _get_window_type(self, iteration: int) -> str:
      return "1d" if iteration % 2 == 0 else "2d"
  
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 2 for calling the CREStereo obj's underlying member method code with example usage: obj._get_window_type(iteration) and returns: unknown