class_docstr: The correlation block.
  
  Creates a correlation pyramid with ``num_levels`` levels from the outputs of the feature encoder,
  and then indexes from this pyramid to create correlation features.
  The "indexing" of a given centroid pixel x' is done by concatenating its surrounding neighbors that
  are within a ``radius``, according to the infinity norm (see paper section 3.2).
  Note: typo in the paper, it should be infinity norm, not 1-norm.
class_docstr_tok: ["The","correlation","block",".","Creates","a","correlation","pyramid","with","``","num_levels","``","levels","from","the","outputs","of","the","feature","encoder",",","and","then","indexes","from","this","pyramid","to","create","correlation","features",".","The","``","indexing","''","of","a","given","centroid","pixel","x","'","is","done","by","concatenating","its","surrounding","neighbors","that","are","within","a","``","radius","``",",","according","to","the","infinity","norm","(","see","paper","section","3.2",")",".","Note",":","typo","in","the","paper",",","it","should","be","infinity","norm",",","not","1-norm","."]
code: def __init__(self, *, num_levels: int = 4, radius: int = 4):
      super().__init__()
      self.num_levels = num_levels
      self.radius = radius
  
      self.corr_pyramid: List[Tensor] = [
          torch.tensor(0)
      ]  # useless, but torchscript is otherwise confused :')
  
      # The neighborhood of a centroid pixel x' is {x' + delta, ||delta||_inf <= radius}
      # so it's a square surrounding x', and its sides have a length of 2 * radius + 1
      # The paper claims that it's ||.||_1 instead of ||.||_inf but it's a typo:
      # https://github.com/princeton-vl/RAFT/issues/122
      self.out_channels = num_levels * (2 * radius + 1) ** 2
  
imports: from typing import List, Optional
  import torch
  import torch.nn
  import torch.nn.functional
  from torch import Tensor
  from torch.nn.modules.batchnorm import BatchNorm2d
  from torch.nn.modules.instancenorm import InstanceNorm2d
  from torchvision.ops import Conv2dNormActivation
  from ...transforms._presets import OpticalFlow
  from ...utils import _log_api_usage_once
  from .._api import register_model, Weights, WeightsEnum
  from .._utils import handle_legacy_interface
  from ._utils import grid_sample, make_coords_grid, upsample_flow
label_desc: Use image node_id 1 to create a new CorrBlock object from inherited base classes: nn with example: obj = CorrBlock()