code: def test_full_custom_model_saving(
      self,
      tmpdir,
      model_configs,
      custom_encoder,
      custom_decoder,
      custom_metric,
  ):
      tmpdir.mkdir("dummy_folder")
      dir_path = dir_path = os.path.join(tmpdir, "dummy_folder")
  
      model = RHVAE(
          model_configs,
          encoder=custom_encoder,
          decoder=custom_decoder,
          metric=custom_metric,
      )
  
      model.state_dict()["encoder.layers.0.0.weight"][0] = 0
  
      model.save(dir_path=dir_path)
  
      assert set(os.listdir(dir_path)) == set(
          [
              "model_config.json",
              "model.pt",
              "encoder.pkl",
              "decoder.pkl",
              "metric.pkl",
              "environment.json",
          ]
      )
  
      # reload model
      model_rec = AutoModel.load_from_folder(dir_path)
  
      # check configs are the same
      assert (
          model_rec.model_config.__dict__ == model.model_config.__dict__
      )
  
      assert all(
          [
              torch.equal(
                  model_rec.state_dict()[key], model.state_dict()[key]
              )
              for key in model.state_dict().keys()
          ]
      )
  
      assert torch.equal(model_rec.M_tens, model.M_tens)
      assert torch.equal(model_rec.centroids_tens, model.centroids_tens)
  
      assert callable(model_rec.G)
      assert callable(model_rec.G_inv)
  
      model_rec.to(device)
  
      z = torch.randn(2, model_configs.latent_dim).to(device)
  
      assert model_rec.G(z).shape == (
          2,
          model_configs.latent_dim,
          model_configs.latent_dim,
      )
      assert model_rec.G_inv(z).shape == (
          2,
          model_configs.latent_dim,
          model_configs.latent_dim,
      )
  
imports: import os
  from copy import deepcopy
  import pytest
  import torch
  from pythae.customexception import BadInheritanceError
  from pythae.models import RHVAE, AutoModel, RHVAEConfig
  from pythae.models.rhvae.rhvae_config import RHVAEConfig
  from pythae.pipelines import GenerationPipeline, TrainingPipeline
  from pythae.samplers import GaussianMixtureSamplerConfig, IAFSamplerConfig, MAFSamplerConfig, NormalSamplerConfig, TwoStageVAESamplerConfig
  from pythae.trainers import BaseTrainer, BaseTrainerConfig
  from tests.data.custom_architectures import Decoder_AE_Conv, Encoder_VAE_Conv, Metric_MLP_Custom, NetBadInheritance
label_desc: Use image node_id 5 for calling the Test_Model_Saving obj's underlying member method code with example usage: obj.test_full_custom_model_saving(tmpdir, model_configs, custom_encoder, custom_decoder, custom_metric) without return types