class_docstr: Inverse Autoregressive Flow.
  
  Args:
      model_config (IAFConfig): The IAF model configuration setting the main parameters of the
          model.
docstr: The prior is transformed toward the input data (f)
  
  Args:
      inputs (torch.Tensor): An input tensor
  
  Returns:
      ModelOutput: An instance of ModelOutput containing all the relevant parameters
docstr_tok: ["The","prior","is","transformed","toward","the","input","data","(","f",")","Args",":","inputs","(","torch.Tensor",")",":","An","input","tensor","Returns",":","ModelOutput",":","An","instance","of","ModelOutput","containing","all","the","relevant","parameters"]
code: def inverse(self, y: torch.Tensor, **kwargs) -> ModelOutput:
      """The prior is transformed toward the input data (f)
  
      Args:
          inputs (torch.Tensor): An input tensor
  
      Returns:
          ModelOutput: An instance of ModelOutput containing all the relevant parameters
      """
      y = y.reshape(y.shape[0], -1)
      sum_log_abs_det_jac = torch.zeros(y.shape[0]).to(y.device)
  
      for layer in self.net[::-1]:
          y = y.flip(dims=(1,))
          if layer.__class__.__name__ == "MADE":
              layer_out = layer(y)
              m, s = layer_out.mu, layer_out.log_var
              y = y * s.exp() + m
              sum_log_abs_det_jac += s.sum(dim=-1)
  
          else:
              layer_out = layer.inverse(y)
              y = layer_out.out
              sum_log_abs_det_jac += layer_out.log_abs_det_jac
  
      return ModelOutput(out=y, log_abs_det_jac=sum_log_abs_det_jac)
  
file_path: benchmark_VAE/src/pythae/models/normalizing_flows/iaf/iaf_model.py
imports: import os
  import numpy
  import torch
  import torch.nn
  from pythae.models.base.base_utils import ModelOutput
  from ..base import BaseNF
  from ..layers import BatchNorm
  from ..made import MADE, MADEConfig
  from .iaf_config import IAFConfig
label_desc: Use image node_id 3 for calling the IAF obj's underlying member method code with example usage: obj.inverse(y) and returns: ModelOutput