class_docstr: RealNVP BatchNorm layer
class_docstr_tok: ["RealNVP","BatchNorm","layer"]
code: def forward(self, x, cond_y=None):
      if self.training:
          self.batch_mean = x.view(-1, x.shape[-1]).mean(0)
          # note MAF paper uses biased variance estimate; ie x.var(0, unbiased=False)
          self.batch_var = x.view(-1, x.shape[-1]).var(0)
  
          # update running mean
          self.running_mean.mul_(self.momentum).add_(
              self.batch_mean.data * (1 - self.momentum)
          )
          self.running_var.mul_(self.momentum).add_(
              self.batch_var.data * (1 - self.momentum)
          )
  
          mean = self.batch_mean
          var = self.batch_var
      else:
          mean = self.running_mean
          var = self.running_var
  
      # compute normalized input (cf original batch norm paper algo 1)
      x_hat = (x - mean) / torch.sqrt(var + self.eps)
      y = self.log_gamma.exp() * x_hat + self.beta
  
      # compute log_abs_det_jacobian (cf RealNVP paper)
      log_abs_det_jacobian = self.log_gamma - 0.5 * torch.log(
          var + self.eps
      )
      #        print('in sum log var {:6.3f} ; out sum log var {:6.3f}; sum log det {:8.3f}; mean log_gamma {:5.3f}; mean beta {:5.3f}'.format(
      #            (var + self.eps).log().sum().data.numpy(), y.var(0).log().sum().data.numpy(), log_abs_det_jacobian.mean(0).item(), self.log_gamma.mean(), self.beta.mean()))
      return y, log_abs_det_jacobian.expand_as(x)
  
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 2 for calling the BatchNorm obj's underlying member method code with example usage: obj.forward(x, cond_y) and returns: y,  log_abs_det_jacobian