class_docstr: A Convolutional discriminator Neural net suited for CIFAR.
  
  
  It can be built as follows:
  
  .. code-block::
  
          >>> from pythae.models.nn.benchmarks.cifar import Discriminator_Conv_CIFAR
          >>> from pythae.models import VAEGANConfig
          >>> model_config = VAEGANConfig(input_dim=(3, 32, 32), latent_dim=16)
          >>> discriminator = Discriminator_Conv_CIFAR(model_config)
          >>> discriminator
          ... Discriminator_Conv_CIFAR(
          ...   (layers): ModuleList(
          ...     (0): Sequential(
          ...       (0): Conv2d(3, 128, kernel_size=(4, 4), stride=(2, 2), padding=(1, 1))
          ...       (1): ReLU()
          ...     )
          ...     (1): Sequential(
          ...       (0): Conv2d(128, 256, kernel_size=(4, 4), stride=(2, 2), padding=(1, 1))
          ...       (1): Tanh()
          ...     )
          ...     (2): Sequential(
          ...       (0): Conv2d(256, 512, kernel_size=(4, 4), stride=(2, 2), padding=(1, 1))
          ...       (1): ReLU()
          ...     )
          ...     (3): Sequential(
          ...       (0): Conv2d(512, 1024, kernel_size=(4, 4), stride=(2, 2), padding=(1, 1))
          ...       (1): ReLU()
          ...     )
          ...     (4): Sequential(
          ...       (0): Linear(in_features=4096, out_features=1, bias=True)
          ...       (1): Sigmoid()
          ...     )
          ...   )
          ... )
  
  and then passed to a :class:`pythae.models` instance
  
      >>> from pythae.models import VAEGAN
      >>> model = VAEGAN(model_config=model_config, discriminator=discriminator)
      >>> model.discriminator == discriminator
      ... True
class_docstr_tok: ["A","Convolutional","discriminator","Neural","net","suited","for","CIFAR",".","It","can","be","built","as","follows",":","..","code-block",":",":",">",">",">","from","pythae.models.nn.benchmarks.cifar","import","Discriminator_Conv_CIFAR",">",">",">","from","pythae.models","import","VAEGANConfig",">",">",">","model_config","=","VAEGANConfig","(","input_dim=","(","3",",","32",",","32",")",",","latent_dim=16",")",">",">",">","discriminator","=","Discriminator_Conv_CIFAR","(","model_config",")",">",">",">","discriminator","...","Discriminator_Conv_CIFAR","(","...","(","layers",")",":","ModuleList","(","...","(","0",")",":","Sequential","(","...","(","0",")",":","Conv2d","(","3",",","128",",","kernel_size=","(","4",",","4",")",",","stride=","(","2",",","2",")",",","padding=","(","1",",","1",")",")","...","(","1",")",":","ReLU","(",")","...",")","...","(","1",")",":","Sequential","(","...","(","0",")",":","Conv2d","(","128",",","256",",","kernel_size=","(","4",",","4",")",",","stride=","(","2",",","2",")",",","padding=","(","1",",","1",")",")","...","(","1",")",":","Tanh","(",")","...",")","...","(","2",")",":","Sequential","(","...","(","0",")",":","Conv2d","(","256",",","512",",","kernel_size=","(","4",",","4",")",",","stride=","(","2",",","2",")",",","padding=","(","1",",","1",")",")","...","(","1",")",":","ReLU","(",")","...",")","...","(","3",")",":","Sequential","(","...","(","0",")",":","Conv2d","(","512",",","1024",",","kernel_size=","(","4",",","4",")",",","stride=","(","2",",","2",")",",","padding=","(","1",",","1",")",")","...","(","1",")",":","ReLU","(",")","...",")","...","(","4",")",":","Sequential","(","...","(","0",")",":","Linear","(","in_features=4096",",","out_features=1",",","bias=True",")","...","(","1",")",":","Sigmoid","(",")","...",")","...",")","...",")","and","then","passed","to","a",":","class",":","`","pythae.models","`","instance",">",">",">","from","pythae.models","import","VAEGAN",">",">",">","model","=","VAEGAN","(","model_config=model_config",",","discriminator=discriminator",")",">",">",">","model.discriminator","==","discriminator","...","True"]
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 adversarial score of the input
      under the key `embedding`. Optional: The outputs of the layers specified in
      `output_layer_levels` arguments are available under the keys `embedding_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","adversarial","score","of","the","input","under","the","key","`","embedding","`",".","Optional",":","The","outputs","of","the","layers","specified","in","`","output_layer_levels","`","arguments","are","available","under","the","keys","`","embedding_layer_i","`","where","i","is","the","layer","'s","level","."]
code: def forward(
      self, x: 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 adversarial score of the input
          under the key `embedding`. Optional: The outputs of the layers specified in
          `output_layer_levels` arguments are available under the keys `embedding_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 = x
  
      for i in range(max_depth):
          if i == 4:
              out = out.reshape(x.shape[0], -1)
  
          out = self.layers[i](out)
  
          if output_layer_levels is not None:
              if i + 1 in output_layer_levels:
                  output[f"embedding_layer_{i+1}"] = out
          if i + 1 == self.depth:
              output["embedding"] = out
  
      return output
  
imports: from typing import List
  import torch
  import torch.nn
  from ....base import BaseAEConfig
  from ....base.base_utils import ModelOutput
  from ...base_architectures import BaseDecoder, BaseDiscriminator, BaseEncoder
label_desc: Use image node_id 2 for calling the Discriminator_Conv_CIFAR obj's underlying member method code with example usage: obj.forward(x, output_layer_levels) and returns: output