class_docstr: A ResNet encoder suited for MNIST and Variational Autoencoder-based models.
  
  It can be built as follows:
  
  .. code-block::
  
      >>> from pythae.models.nn.benchmarks.mnist import Encoder_ResNet_VAE_MNIST
      >>> from pythae.models import VAEConfig
      >>> model_config = VAEConfig(input_dim=(1, 28, 28), latent_dim=16)
      >>> encoder = Encoder_ResNet_VAE_MNIST(model_config)
      >>> encoder
      ... Encoder_ResNet_VAE_MNIST(
      ...   (layers): ModuleList(
      ...     (0): Sequential(
      ...       (0): Conv2d(1, 64, kernel_size=(4, 4), stride=(2, 2), padding=(1, 1))
      ...     )
      ...     (1): Sequential(
      ...       (0): Conv2d(64, 128, kernel_size=(4, 4), stride=(2, 2), padding=(1, 1))
      ...     )
      ...     (2): Sequential(
      ...       (0): Conv2d(128, 128, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))
      ...     )
      ...     (3): Sequential(
      ...       (0): ResBlock(
      ...         (conv_block): Sequential(
      ...           (0): ReLU()
      ...           (1): Conv2d(128, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
      ...           (2): ReLU()
      ...           (3): Conv2d(32, 128, kernel_size=(1, 1), stride=(1, 1))
      ...         )
      ...       )
      ...       (1): ResBlock(
      ...         (conv_block): Sequential(
      ...           (0): ReLU()
      ...           (1): Conv2d(128, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
      ...           (2): ReLU()
      ...           (3): Conv2d(32, 128, kernel_size=(1, 1), stride=(1, 1))
      ...         )
      ...       )
      ...     )
      ...   )
      ...   (embedding): Linear(in_features=2048, out_features=16, bias=True)
      ...   (log_var): Linear(in_features=2048, out_features=16, bias=True)
      ... )
  
  
  and then passed to a :class:`pythae.models` instance
  
      >>> from pythae.models import VAE
      >>> model = VAE(model_config=model_config, encoder=encoder)
      >>> model.encoder == encoder
      ... True
  
  .. note::
  
      Please note that this encoder is only suitable for Autoencoder based models since it only
      outputs the embeddings of the input data under the key `embedding`.
  
      .. code-block::
  
          >>> import torch
          >>> input = torch.rand(2, 1, 28, 28)
          >>> out = encoder(input)
          >>> out.embedding.shape
          ... torch.Size([2, 16])
code: def __init__(self, args: BaseAEConfig):
      BaseEncoder.__init__(self)
  
      self.input_dim = (1, 28, 28)
      self.latent_dim = args.latent_dim
      self.n_channels = 1
  
      layers = nn.ModuleList()
  
      layers.append(
          nn.Sequential(nn.Conv2d(self.n_channels, 64, 4, 2, padding=1))
      )
  
      layers.append(nn.Sequential(nn.Conv2d(64, 128, 4, 2, padding=1)))
  
      layers.append(nn.Sequential(nn.Conv2d(128, 128, 3, 2, padding=1)))
  
      layers.append(
          nn.Sequential(
              ResBlock(in_channels=128, out_channels=32),
              ResBlock(in_channels=128, out_channels=32),
          )
      )
  
      self.layers = layers
      self.depth = len(layers)
  
      self.embedding = nn.Linear(128 * 4 * 4, args.latent_dim)
      self.log_var = nn.Linear(128 * 4 * 4, args.latent_dim)
  
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, BaseEncoder
  from ..utils import ResBlock
label_desc: Use image node_id 1 to create a new Encoder_ResNet_VAE_MNIST object from inherited base classes: BaseEncoder with example: obj = Encoder_ResNet_VAE_MNIST(args)