class_docstr: A proposed fully Convolutional decoder for VQVAE.
class_docstr_tok: ["A","proposed","fully","Convolutional","decoder","for","VQVAE","."]
docstr: Forward method
  
  Returns:
      ModelOutput: An instance of ModelOutput containing the reconstruction of the latent code
      under the key `reconstruction`
docstr_tok: ["Forward","method","Returns",":","ModelOutput",":","An","instance","of","ModelOutput","containing","the","reconstruction","of","the","latent","code","under","the","key","`","reconstruction","`"]
code: def forward(
      self, z: torch.Tensor, output_layer_levels: List[int] = None
  ):
      """Forward method
  
      Returns:
          ModelOutput: An instance of ModelOutput containing the reconstruction of the latent code
          under the key `reconstruction`
      """
      output = ModelOutput()
  
      max_depth = self.depth
  
      z = z.reshape(-1, 1, 4, 4)
  
      if output_layer_levels is not None:
          assert all(
              self.depth >= levels > 0 or levels == -1
              for levels in output_layer_levels
          ), (
              f"Cannot output layer deeper than depth ({self.depth})."
              f"Got ({output_layer_levels})"
          )
  
          if -1 in output_layer_levels:
              max_depth = self.depth
          else:
              max_depth = max(output_layer_levels)
  
      out = z
  
      for i in range(max_depth):
          out = self.layers[i](out)
  
          if output_layer_levels is not None:
              if i + 1 in output_layer_levels:
                  output[f"reconstruction_layer_{i+1}"] = out
  
          if i + 1 == self.depth:
              output["reconstruction"] = out
  
      return output
  
file_path: benchmark_VAE/examples/scripts/custom_nn.py
imports: from typing import List
  import numpy
  import torch
  import torch.nn
  from pythae.models import BaseAEConfig
  from pythae.models.base.base_utils import ModelOutput
  from pythae.models.nn import BaseDecoder, BaseDiscriminator, BaseEncoder
  from pythae.models.nn.base_architectures import BaseDecoder, BaseEncoder
label_desc: Use image node_id 2 for calling the Fully_Conv_Decoder_Conv_AE_MNIST obj's underlying member method code with example usage: obj.forward(z, output_layer_levels) and returns: output