class_docstr: Glue together encoder transform, entropy model and decoder transform
docstr: Encodes and decodes latents/scenes
  
  Args:
      scenes: Scenes object, containing `tensor` attribute of shape [B, T, C, H, W]
      cache: Cache object
  
  Yields:
      `NetworkOut` object containng reconstruction of the scene/latent and
          likelihoods
docstr_tok: ["Encodes","and","decodes","latents\/scenes","Args",":","scenes",":","Scenes","object",",","containing","`","tensor","`","attribute","of","shape","[","B",",","T",",","C",",","H",",","W","]","cache",":","Cache","object","Yields",":","`","NetworkOut","`","object","containng","reconstruction","of","the","scene\/latent","and","likelihoods"]
code: def encode_and_decode_scenes(
      self, scenes: Scenes, cache: memoize.Cache
  ) -> Generator[NetworkOut, None, None]:
      """Encodes and decodes latents/scenes
  
      Args:
          scenes: Scenes object, containing `tensor` attribute of shape [B, T, C, H, W]
          cache: Cache object
  
      Yields:
          `NetworkOut` object containng reconstruction of the scene/latent and
              likelihoods
      """
      encode_outs = self.encode_scenes(scenes, cache=cache)
  
      # Iterate over `encode_outs` twice: once to decode and once to construct and
      # yield the NetworkOut object
      encode_outs, encode_outs_tee = itertools.tee(encode_outs)
      reconstructions_scenes = self.decode_scenes(
          (encode_out for encode_out in encode_outs_tee), cache=cache
      )  # [B, C, H, W]
  
      for rec_scene, encode_out in zip(
          reconstructions_scenes, encode_outs
      ):
          # rec_scene is padded [B, C, H, W]
          yield NetworkOut(
              reconstruction=rec_scene,
              likelihood=encode_out.likelihood,
          )
  
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 8 for calling the VCTPipeline obj's underlying member method code with example usage: obj.encode_and_decode_scenes(scenes, cache) without return types