code: def compute_flow_loss(
      z, log_det_W_list, log_s_list, n_elements, n_dims, mask, sigma=1.0
  ):
      log_det_W_total = 0.0
      for i, log_s in enumerate(log_s_list):
          if i == 0:
              log_s_total = torch.sum(log_s * mask)
              if len(log_det_W_list):
                  log_det_W_total = log_det_W_list[i]
          else:
              log_s_total = log_s_total + torch.sum(log_s * mask)
              if len(log_det_W_list):
                  log_det_W_total += log_det_W_list[i]
  
      if len(log_det_W_list):
          log_det_W_total *= n_elements
  
      z = z * mask
      prior_NLL = torch.sum(z * z) / (2 * sigma * sigma)
  
      loss = prior_NLL - log_s_total - log_det_W_total
  
      denom = n_elements * n_dims
      loss = loss / denom
      loss_prior = prior_NLL / denom
      return loss, loss_prior
  
file_path: NeMo/nemo/collections/tts/losses/radttsloss.py
imports: import torch
  from torch.nn import functional
  from nemo.collections.tts.losses.aligner_loss import ForwardSumLoss
  from nemo.collections.tts.parts.utils.helpers import get_mask_from_lengths
  from nemo.core.classes import Loss
label_desc: Use image node_id 1 for calling a global function with example usage: compute_flow_loss(z, log_det_W_list, log_s_list, n_elements, n_dims, mask, sigma) and returns: loss,  loss_prior