code: def test_ae_encoding_decoding(
      self, ae_celeba_config, celeba_like_data, recon_layers
  ):
      encoder = Encoder_Conv_AE_CELEBA(ae_celeba_config).to(device)
      decoder = Decoder_Conv_AE_CELEBA(ae_celeba_config).to(device)
  
      embedding = encoder(celeba_like_data).embedding
  
      assert embedding.shape == (
          celeba_like_data.shape[0],
          ae_celeba_config.latent_dim,
      )
  
      reconstruction = decoder(embedding).reconstruction
  
      assert reconstruction.shape == celeba_like_data.shape
  
      encoder_embed = encoder(
          celeba_like_data, output_layer_levels=recon_layers
      )
      decoder_recon = decoder(
          embedding, output_layer_levels=recon_layers
      )
  
      if recon_layers is None:
          assert "embedding" in encoder_embed.keys()
          assert "reconstruction" in decoder_recon.keys()
  
      else:
          for lev in recon_layers:
              if lev != -1:
                  assert (
                      f"embedding_layer_{lev}" in encoder_embed.keys()
                  )
                  assert (
                      f"reconstruction_layer_{lev}"
                      in decoder_recon.keys()
                  )
  
              else:
                  assert "embedding" in encoder_embed.keys()
                  assert "reconstruction" in decoder_recon.keys()
  
      if recon_layers is None:
          assert (
              encoder_embed["embedding"].shape[1]
              == ae_celeba_config.latent_dim
          )
          assert (
              decoder_recon[f"reconstruction"].shape[1:]
              == ae_celeba_config.input_dim
          )
  
      else:
          if 1 in recon_layers:
              assert encoder_embed[f"embedding_layer_1"].shape[1] == 128
              assert (
                  decoder_recon[f"reconstruction_layer_1"].shape[1]
                  == 1024
              )
  
          if 2 in recon_layers:
              assert encoder_embed[f"embedding_layer_2"].shape[1] == 256
              assert (
                  decoder_recon[f"reconstruction_layer_2"].shape[1]
                  == 512
              )
  
          if 3 in recon_layers:
              assert encoder_embed[f"embedding_layer_3"].shape[1] == 512
              assert (
                  decoder_recon[f"reconstruction_layer_3"].shape[1]
                  == 256
              )
  
          if 4 in recon_layers:
              assert (
                  encoder_embed[f"embedding_layer_4"].shape[1] == 1024
              )
              assert (
                  decoder_recon[f"reconstruction_layer_4"].shape[1]
                  == 128
              )
  
          if 5 in recon_layers:
              assert (
                  decoder_recon[f"reconstruction_layer_4"].shape[1:]
                  == ae_celeba_config.input_dim
              )
  
          if -1 in recon_layers:
              assert (
                  encoder_embed["embedding"].shape[1]
                  == ae_celeba_config.latent_dim
              )
              assert (
                  decoder_recon[f"reconstruction"].shape[1:]
                  == ae_celeba_config.input_dim
              )
  
imports: import numpy
  import pytest
  import torch
  from pythae.models import AEConfig, VAEConfig
  from pythae.models.nn.benchmarks.celeba import *
  from pythae.models.nn.benchmarks.cifar import *
  from pythae.models.nn.benchmarks.mnist import *
  from pythae.models.nn.default_architectures import *
label_desc: Use image node_id 2 for calling the Test_CELEBA_ConvNets obj's underlying member method code with example usage: obj.test_ae_encoding_decoding(ae_celeba_config, celeba_like_data, recon_layers) without return types