class_docstr: DIPVAEExplainer can be used to visualize the changes in the latent space of Disentangled Inferred Prior-VAE
  or DIPVAE [#1]_. This model is a Variational Autoencoder [#2]_ variant that leads to a
  disentangled latent space. This is achieved by matching the covariance of the prior distributions with the
  inferred prior.
  
  References:
      .. [#1] `Variational Inference of Disentangled Latent Concepts from Unlabeled Observations (DIP-VAE), ICLR 2018.
       Kumar, Sattigeri, Balakrishnan. <https://arxiv.org/abs/1711.00848>`_
      .. [#2] `Diederik P Kingma and Max Welling. Auto-encoding variational Bayes. ICLR, 2014. <https://arxiv.org/pdf/1312.6114.pdf>`_
class_docstr_tok: ["DIPVAEExplainer","can","be","used","to","visualize","the","changes","in","the","latent","space","of","Disentangled","Inferred","Prior-VAE","or","DIPVAE","[","#","1","]","_",".","This","model","is","a","Variational","Autoencoder","[","#","2","]","_","variant","that","leads","to","a","disentangled","latent","space",".","This","is","achieved","by","matching","the","covariance","of","the","prior","distributions","with","the","inferred","prior",".","References",":","..","[","#","1","]","`","Variational","Inference","of","Disentangled","Latent","Concepts","from","Unlabeled","Observations","(","DIP-VAE",")",",","ICLR","2018",".","Kumar",",","Sattigeri",",","Balakrishnan",".","<","https",":","\/\/arxiv.org\/abs\/1711.00848",">","`","_","..","[","#","2","]","`","Diederik","P","Kingma","and","Max","Welling",".","Auto-encoding","variational","Bayes",".","ICLR",",","2014",".","<","https",":","\/\/arxiv.org\/pdf\/1312.6114.pdf",">","`","_"]
docstr: Edits the images in the latent space and returns the generated images.
  
  Args:
      input_images: The input images.
      edit_dim_id: The latent dimension id that need to be edited.
      edit_dim_value: The value that is assigned to the latent dimension with id edit_dim_id.
      edit_z_sample: If True will use the sample from encoder instead of the mean.
  Returns:
      Edited images.
docstr_tok: ["Edits","the","images","in","the","latent","space","and","returns","the","generated","images",".","Args",":","input_images",":","The","input","images",".","edit_dim_id",":","The","latent","dimension","id","that","need","to","be","edited",".","edit_dim_value",":","The","value","that","is","assigned","to","the","latent","dimension","with","id","edit_dim_id",".","edit_z_sample",":","If","True","will","use","the","sample","from","encoder","instead","of","the","mean",".","Returns",":","Edited","images","."]
code: def explain(
      self,
      input_images,
      edit_dim_id,
      edit_dim_value,
      edit_z_sample=False,
  ):
      """
      Edits the images in the latent space and returns the generated images.
  
      Args:
          input_images: The input images.
          edit_dim_id: The latent dimension id that need to be edited.
          edit_dim_value: The value that is assigned to the latent dimension with id edit_dim_id.
          edit_z_sample: If True will use the sample from encoder instead of the mean.
      Returns:
          Edited images.
      """
  
      reference_z, reference_mu, reference_std = self.net.encode(
          input_images
      )
      if edit_z_sample:
          edited_z = reference_z
          edited_z[:, edit_dim_id] = edit_dim_value
      else:
          edited_z = reference_mu
          edited_z[:, edit_dim_id] = edit_dim_value
  
      edited_images = self.net.decode(edited_z)
  
      return edited_images
  
file_path: AIX360/aix360/algorithms/dipvae/dipvae.py
imports: from __future__ import print_function
  import torch
  from torch import __init__
  from torch.optim import Adam
  from .dipvae_utils import VAE, DIPVAE
  from .dipvae_utils import plot_reconstructions, plot_latent_traversal
  from aix360.algorithms.die import DIExplainer
  import os
  import sys
  import random
  import time
  import numpy
label_desc: Use image node_id 3 for calling the DIPVAEExplainer obj's underlying member method code with example usage: obj.explain(input_images, edit_dim_id, edit_dim_value, edit_z_sample) and returns: edited_images