class_docstr: Deep Video Compression composition class.
  
  This composes the Deep Video Compression Module of Lu (2019). It requires
  defining a motion estimator, a motion autoencoder, a motion compensator,
  and a residual autoencoder. The individual modules can be input by the
  user. If the user does not input a module, then this class will construct
  the module with default parameters from the paper.
  
  Lu, Guo, et al. "DVC: An end-to-end deep video compression framework."
  CVPR (2019).
  
  Args:
      coder_channels: Number of channels to use for autoencoders.
      motion_estimator: A module for estimating motion. See
          ``DVCPyramidFlowEstimator`` for an example.
      motion_encoder: A module for encoding motion fields. See
          ``DVCCompressionEncoder`` for an example.
      motion_entropy_bottleneck: A module for quantization and latent
          probability estimation for the compressed motion fields. See
          ``EntropyBottleneck`` for an example.
      motion_decoder: A module for decoding motion fields. See
          ``DVCCompressionDecoder`` for an example.
      motion_compensation: A module for compensating for motion errors. See
          ``DVCMotionCompensationModel`` for an example.
      residual_encoder: A module for encoding residuals after motion
          compensation. See ``DVCCompressionEncoder`` with 3 input channels
          for an example.
      residual_entropy_bottleneck: A module for quantization and latent
          probability estimation for the compressed residuals. See
          ``EntropyBottleneck`` for an example.
      residual_decoder: A module for decoding residuals. See
          ``DVCCompressionEncoder`` with 3 output channels for an example.
class_docstr_tok: ["Deep","Video","Compression","composition","class",".","This","composes","the","Deep","Video","Compression","Module","of","Lu","(","2019",")",".","It","requires","defining","a","motion","estimator",",","a","motion","autoencoder",",","a","motion","compensator",",","and","a","residual","autoencoder",".","The","individual","modules","can","be","input","by","the","user",".","If","the","user","does","not","input","a","module",",","then","this","class","will","construct","the","module","with","default","parameters","from","the","paper",".","Lu",",","Guo",",","et","al",".","``","DVC",":","An","end-to-end","deep","video","compression","framework",".","''","CVPR","(","2019",")",".","Args",":","coder_channels",":","Number","of","channels","to","use","for","autoencoders",".","motion_estimator",":","A","module","for","estimating","motion",".","See","``","DVCPyramidFlowEstimator","``","for","an","example",".","motion_encoder",":","A","module","for","encoding","motion","fields",".","See","``","DVCCompressionEncoder","``","for","an","example",".","motion_entropy_bottleneck",":","A","module","for","quantization","and","latent","probability","estimation","for","the","compressed","motion","fields",".","See","``","EntropyBottleneck","``","for","an","example",".","motion_decoder",":","A","module","for","decoding","motion","fields",".","See","``","DVCCompressionDecoder","``","for","an","example",".","motion_compensation",":","A","module","for","compensating","for","motion","errors",".","See","``","DVCMotionCompensationModel","``","for","an","example",".","residual_encoder",":","A","module","for","encoding","residuals","after","motion","compensation",".","See","``","DVCCompressionEncoder","``","with","3","input","channels","for","an","example",".","residual_entropy_bottleneck",":","A","module","for","quantization","and","latent","probability","estimation","for","the","compressed","residuals",".","See","``","EntropyBottleneck","``","for","an","example",".","residual_decoder",":","A","module","for","decoding","residuals",".","See","``","DVCCompressionEncoder","``","with","3","output","channels","for","an","example","."]
docstr: Apply DVC coding to a pair of images.
  
  The ``forward`` function is expected to be used for training. For
  inference, see the ``compress`` and ``decompress``.
  
  Args:
      image1: The base image.
      image2: The second image. Optical flow will be applied to
          ``image1`` to predict ``image2``.
  
  Returns:
      A 5-tuple training output containing 1) the calculated optical
      flow, 2) an estimate of ``image2`` including motion compensation,
      3) the residual between ``image2`` and its estimate, 4) the
      probabilities output by the flow quantizer, and 5) the
      probabilities output by the residual quantizer.
code: def forward(self, image1: Tensor, image2: Tensor) -> DVCTrainOutput:
      """
      Apply DVC coding to a pair of images.
  
      The ``forward`` function is expected to be used for training. For
      inference, see the ``compress`` and ``decompress``.
  
      Args:
          image1: The base image.
          image2: The second image. Optical flow will be applied to
              ``image1`` to predict ``image2``.
  
      Returns:
          A 5-tuple training output containing 1) the calculated optical
          flow, 2) an estimate of ``image2`` including motion compensation,
          3) the residual between ``image2`` and its estimate, 4) the
          probabilities output by the flow quantizer, and 5) the
          probabilities output by the residual quantizer.
      """
      # estimate optical flow fields
      flow = self.motion_estimator(image1, image2)
  
      # compress optical flow fields
      flow, sizes = self.motion_encoder(flow)
      flow, flow_probabilities = self.motion_entropy_bottleneck(flow)
      flow = self.motion_decoder(flow, sizes)
  
      # apply optical flow fields
      image2_est = ncF.dense_image_warp(
          image1, flow.permute(0, 2, 3, 1)
      )
  
      # compensate for optical flow errors
      image2_est = self.motion_compensation(image1, image2_est, flow)
  
      # encode final residual
      residual = image2 - image2_est
      residual, sizes = self.residual_encoder(residual)
      residual, resid_probabilities = self.residual_entropy_bottleneck(
          residual
      )
      residual = self.residual_decoder(residual, sizes)
  
      image2_est = image2_est + residual
  
      return DVCTrainOutput(
          flow,
          image2_est,
          residual,
          flow_probabilities,
          resid_probabilities,
      )
  
imports: from typing import Any, List, NamedTuple, Optional, Sequence, Tuple
  import torch
  import torch.nn.functional
  from compressai.entropy_models import EntropyBottleneck
  from torch import Tensor, nn
  import neuralcompression.functional
  from neuralcompression.layers import SimplifiedGDN, SimplifiedInverseGDN
label_desc: Use image node_id 5 for calling the DVC obj's underlying member method code with example usage: obj.forward(image1, image2) and returns: DVCTrainOutput