class_docstr: Glue together encoder transform, entropy model and decoder transform
docstr: Args:
      x: tensor of size [B, T, C, H, W] to pad
      sizes: height and width of x
      factor: optional, if provided this is the factor to pad x to.
          Defaults to None.
  Returns:
      padded tensor of size [B, T, C, H+pad_h, W+pad_w]
docstr_tok: ["Args",":","x",":","tensor","of","size","[","B",",","T",",","C",",","H",",","W","]","to","pad","sizes",":","height","and","width","of","x","factor",":","optional",",","if","provided","this","is","the","factor","to","pad","x","to",".","Defaults","to","None",".","Returns",":","padded","tensor","of","size","[","B",",","T",",","C",",","H+pad_h",",","W+pad_w","]"]
code: def _pad(
      self,
      x: Tensor,
      sizes: Sequence[int],
      factor: Optional[int] = None,
  ) -> Tensor:
      """
      Args:
          x: tensor of size [B, T, C, H, W] to pad
          sizes: height and width of x
          factor: optional, if provided this is the factor to pad x to.
              Defaults to None.
      Returns:
          padded tensor of size [B, T, C, H+pad_h, W+pad_w]
      """
      if factor is None:
          n_im_downscale = getattr(
              self.analysis_transform, "num_downsampling_layers", 0
          )
          n_hyper_downscale = getattr(
              self.entropy_model, "num_downsampling_layers", 0
          )
          factor = 2 ** (n_im_downscale + n_hyper_downscale)
  
      pad_h, pad_w = [(factor - (s % factor)) % factor for s in sizes]  # type: ignore
      # dims are in reverse -- W, H, C, so the below pads:
      # width dimension by 0, pad_w, height by 0, pad_h and no padding for channel
      return torch.nn.functional.pad(
          x, (0, pad_w, 0, pad_h, 0, 0), "reflect"
      )
  
imports: import itertools
  import math
  from typing import Generator, List, NamedTuple, Optional, Sequence, Tuple, Union
  import torch
  import torch.nn
  import utils.memoize
  from datamodules.video_data_api import Scenes, VideoData
  from neural.entropy_model import PreviousLatent, VCTEntropyModel
  from torch import Tensor
label_desc: Use image node_id 9 for calling the VCTPipeline obj's underlying member method code with example usage: obj._pad(x, sizes, factor) and returns: torch