code: def test_DIPVAEExplainer(self):
      # Load the dataset object
      dataset_obj = FakeFMnistDataset()
      self.assertIsNotNone(dataset_obj)
  
      cuda_available = torch.cuda.is_available()
  
      # Initialize model arguments
      dipvaeii_args = argparse.Namespace()
  
      dipvaeii_args.model = "dipvae-ii"
  
      dipvaeii_args.activation_type = "relu"
      dipvaeii_args.num_nodes = 1200
      dipvaeii_args.latent_dim = 10
      dipvaeii_args.num_gen_layers = 3
      dipvaeii_args.num_inference_layers = 2
  
      dipvaeii_args.step_size = 0.001
      dipvaeii_args.lambda_diag_factor = 10.0
      dipvaeii_args.lambda_offdiag = 0.001
  
      dipvaeii_args.seed = 0
  
      # Run for 2 epochs for testing elbo increase
      dipvaeii_args.num_epochs = 2
  
      # Initialize the explainer model
      dipvaeii_explainer = DIPVAEExplainer(
          model_args=dipvaeii_args,
          dataset=dataset_obj,
          cuda_available=cuda_available,
      )
  
      # Fit the generative model.
      loss_epoch_list = dipvaeii_explainer.fit()
  
      for x, _ in dataset_obj.next_test_batch():
          input_images = x.squeeze().view(
              -1, np.prod(dataset_obj.data_dims)
          )
          break
  
      convert_and_reshape = (
          lambda x: x.cpu()
          .data.numpy()
          .reshape([-1] + dataset_obj.data_dims)
      )
      edited_images = dipvaeii_explainer.explain(
          input_images=input_images,
          edit_dim_id=0,
          edit_dim_value=-1.0,
          edit_z_sample=True,
      )
  
      # Make sure edited images are different
      self.assertGreater(
          np.linalg.norm(
              np.abs(
                  convert_and_reshape(input_images)
                  - convert_and_reshape(edited_images)
              )
          ),
          0.0,
      )
  
file_path: AIX360/tests/dipvae/test_DIPVAE.py
imports: import unittest
  from aix360.algorithms.dipvae import DIPVAEExplainer
  import torch
  import torchvision.datasets
  import torchvision.transforms
  import argparse
  import numpy
label_desc: Use image node_id 1 for calling the TestDIPVAEExplainer obj's underlying member method code with example usage: obj.test_DIPVAEExplainer() without return types