class_docstr: A Convolutional decoder suited for MNIST and Autoencoder-based
  models.
  
  .. code-block::
  
          >>> from pythae.models.nn.benchmarks.mnist import Decoder_Conv_AE_MNIST
          >>> from pythae.models import VAEConfig
          >>> model_config = VAEConfig(input_dim=(1, 28, 28), latent_dim=16)
          >>> decoder = Decoder_Conv_AE_MNIST(model_config)
          >>> decoder
          ... Decoder_Conv_AE_MNIST(
          ...   (layers): ModuleList(
          ...     (0): Linear(in_features=16, out_features=16384, bias=True)
          ...     (1): Sequential(
          ...       (0): ConvTranspose2d(1024, 512, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))
          ...       (1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          ...       (2): ReLU()
          ...     )
          ...     (2): Sequential(
          ...       (0): ConvTranspose2d(512, 256, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), output_padding=(1, 1))
          ...       (1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          ...       (2): ReLU()
          ...     )
          ...     (3): Sequential(
          ...       (0): ConvTranspose2d(256, 1, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), output_padding=(1, 1))
          ...       (1): Sigmoid()
          ...     )
          ...   )
          ... )
  
  
  and then passed to a :class:`pythae.models` instance
  
      >>> from pythae.models import VAE
      >>> model = VAE(model_config=model_config, decoder=decoder)
      >>> model.decoder == decoder
      ... True
  
  .. note::
  
      Please note that this decoder is suitable for **all** models.
  
      .. code-block::
  
          >>> import torch
          >>> input = torch.randn(2, 16)
          >>> out = decoder(input)
          >>> out.reconstruction.shape
          ... torch.Size([2, 1, 28, 28])
class_docstr_tok: ["A","Convolutional","decoder","suited","for","MNIST","and","Autoencoder-based","models",".","..","code-block",":",":",">",">",">","from","pythae.models.nn.benchmarks.mnist","import","Decoder_Conv_AE_MNIST",">",">",">","from","pythae.models","import","VAEConfig",">",">",">","model_config","=","VAEConfig","(","input_dim=","(","1",",","28",",","28",")",",","latent_dim=16",")",">",">",">","decoder","=","Decoder_Conv_AE_MNIST","(","model_config",")",">",">",">","decoder","...","Decoder_Conv_AE_MNIST","(","...","(","layers",")",":","ModuleList","(","...","(","0",")",":","Linear","(","in_features=16",",","out_features=16384",",","bias=True",")","...","(","1",")",":","Sequential","(","...","(","0",")",":","ConvTranspose2d","(","1024",",","512",",","kernel_size=","(","3",",","3",")",",","stride=","(","2",",","2",")",",","padding=","(","1",",","1",")",")","...","(","1",")",":","BatchNorm2d","(","512",",","eps=1e-05",",","momentum=0.1",",","affine=True",",","track_running_stats=True",")","...","(","2",")",":","ReLU","(",")","...",")","...","(","2",")",":","Sequential","(","...","(","0",")",":","ConvTranspose2d","(","512",",","256",",","kernel_size=","(","3",",","3",")",",","stride=","(","2",",","2",")",",","padding=","(","1",",","1",")",",","output_padding=","(","1",",","1",")",")","...","(","1",")",":","BatchNorm2d","(","256",",","eps=1e-05",",","momentum=0.1",",","affine=True",",","track_running_stats=True",")","...","(","2",")",":","ReLU","(",")","...",")","...","(","3",")",":","Sequential","(","...","(","0",")",":","ConvTranspose2d","(","256",",","1",",","kernel_size=","(","3",",","3",")",",","stride=","(","2",",","2",")",",","padding=","(","1",",","1",")",",","output_padding=","(","1",",","1",")",")","...","(","1",")",":","Sigmoid","(",")","...",")","...",")","...",")","and","then","passed","to","a",":","class",":","`","pythae.models","`","instance",">",">",">","from","pythae.models","import","VAE",">",">",">","model","=","VAE","(","model_config=model_config",",","decoder=decoder",")",">",">",">","model.decoder","==","decoder","...","True","..","note",":",":","Please","note","that","this","decoder","is","suitable","for","*","*","all","*","*","models",".","..","code-block",":",":",">",">",">","import","torch",">",">",">","input","=","torch.randn","(","2",",","16",")",">",">",">","out","=","decoder","(","input",")",">",">",">","out.reconstruction.shape","...","torch.Size","(","[","2",",","1",",","28",",","28","]",")"]
docstr: Forward method
  
  Args:
      output_layer_levels (List[int]): The levels of the layers where the outputs are
          extracted. If None, the last layer's output is returned. Default: None.
  
  Returns:
      ModelOutput: An instance of ModelOutput containing the reconstruction of the latent code
      under the key `reconstruction`. Optional: The outputs of the layers specified in
      `output_layer_levels` arguments are available under the keys `reconstruction_layer_i`
      where i is the layer's level.
docstr_tok: ["Forward","method","Args",":","output_layer_levels","(","List","[","int","]",")",":","The","levels","of","the","layers","where","the","outputs","are","extracted",".","If","None",",","the","last","layer","'s","output","is","returned",".","Default",":","None",".","Returns",":","ModelOutput",":","An","instance","of","ModelOutput","containing","the","reconstruction","of","the","latent","code","under","the","key","`","reconstruction","`",".","Optional",":","The","outputs","of","the","layers","specified","in","`","output_layer_levels","`","arguments","are","available","under","the","keys","`","reconstruction_layer_i","`","where","i","is","the","layer","'s","level","."]
code: def forward(
      self, z: torch.Tensor, output_layer_levels: List[int] = None
  ):
      """Forward method
  
      Args:
          output_layer_levels (List[int]): The levels of the layers where the outputs are
              extracted. If None, the last layer's output is returned. Default: None.
  
      Returns:
          ModelOutput: An instance of ModelOutput containing the reconstruction of the latent code
          under the key `reconstruction`. Optional: The outputs of the layers specified in
          `output_layer_levels` arguments are available under the keys `reconstruction_layer_i`
          where i is the layer's level.
      """
      output = ModelOutput()
  
      max_depth = self.depth
  
      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 i == 0:
              out = out.reshape(z.shape[0], 1024, 4, 4)
  
          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
  
imports: from typing import List
  import torch
  import torch.nn
  from pythae.models.nn import BaseDecoder, BaseDiscriminator, BaseEncoder
  from ....base import BaseAEConfig
  from ....base.base_utils import ModelOutput
  from ...base_architectures import BaseDecoder, BaseEncoder
label_desc: Use image node_id 2 for calling the Decoder_Conv_AE_MNIST obj's underlying member method code with example usage: obj.forward(z, output_layer_levels) and returns: output