class_docstr: Modified RealNVP Coupling Layers per the MAF paper
class_docstr_tok: ["Modified","RealNVP","Coupling","Layers","per","the","MAF","paper"]
code: def inverse(self, u, y=None):
      # apply mask
      mu = u * self.mask
  
      # run through model
      s = self.s_net(mu if y is None else torch.cat([y, mu], dim=-1))
      t = self.t_net(
          mu if y is None else torch.cat([y, mu], dim=-1)
      ) * (1 - self.mask)
  
      log_s = torch.tanh(s) * (1 - self.mask)
      x = (u - t) * torch.exp(-log_s)
      # x = u * torch.exp(log_s) + t
      # x = mu + (1 - self.mask) * (u * s.exp() + t)  # cf RealNVP eq 7
  
      # log_abs_det_jacobian = (1 - self.mask) * s  # log det dx/du
      # log_abs_det_jacobian = log_s #.sum(-1, keepdim=True)
      log_abs_det_jacobian = -log_s
  
      return x, log_abs_det_jacobian
  
imports: import copy
  import math
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.distributions import Normal
label_desc: Use image node_id 3 for calling the LinearMaskedCoupling obj's underlying member method code with example usage: obj.inverse(u, y) and returns: x,  log_abs_det_jacobian