class_docstr: Correlation Cost Layer.
  
  This layer implements the correlation operation from [FlowNet Learning
  Optical Flow with Convolutional Networks](https://arxiv.org/abs/1504.06852)(Fischer et al.).
  
  Args:
      kernel_size: An integer specifying the height and width of the
          patch used to compute the per-patch costs.
      max_displacement: An integer specifying the maximum search radius
          for each position.
      stride_1: An integer specifying the stride length in the input.
      stride_2: An integer specifying the stride length in the patch.
      pad: An integer specifying the paddings in height and width.
      data_format: Specifies the data format.
          Possible values are:
              "channels_last" float [batch, height, width, channels]
              "channels_first" float [batch, channels, height, width]
              Defaults to `"channels_last"`.
code: def compute_output_shape(self, input_shape):
      assert isinstance(input_shape, list)
  
      #  Input validation
      if len(input_shape) != 2:
          raise ValueError("Input must be a list of two shapes")
  
      for idx in range(4):
          if input_shape[0][idx] != input_shape[1][idx]:
              raise ValueError("Input shapes must match")
  
      n = input_shape[0][0]
      r = self.max_displacement // self.stride_2
      bd = self.max_displacement + (self.kernel_size - 1) // 2
      output_c = (2 * r + 1) ** 2
  
      if self.data_format == "channels_first":
          output_h = (
              input_shape[0][2] + 2 * (self.pad - bd) // self.stride_1
          )
          output_w = (
              input_shape[0][3] + 2 * (self.pad - bd) // self.stride_1
          )
          return [(n, output_c, output_h, output_w)]
  
      elif self.data_format == "channels_last":
          output_h = (
              input_shape[0][1] + 2 * (self.pad - bd) // self.stride_1
          )
          output_w = (
              input_shape[0][2] + 2 * (self.pad - bd) // self.stride_1
          )
          return [(n, output_h, output_w, output_c)]
      else:
          raise ValueError(
              "`data_format` must be either `channels_last` or"
              "`channels_first`"
          )
  
file_path: addons/tensorflow_addons/layers/optical_flow.py
imports: import tensorflow
  from typeguard import typechecked
  from tensorflow_addons.utils.resource_loader import LazySO
label_desc: Use image node_id 4 for calling the CorrelationCost obj's underlying member method code with example usage: obj.compute_output_shape(input_shape) and returns: list, list