code: def cross_iwaes(qz_xs, px_zs, zss, x):
      lws = []
      for e, _px_zs in enumerate(px_zs):  # rows are encoders
          lpz = model.pz(*model.pz_params).log_prob(zss[e]).sum(-1)
          lqz_x = qz_xs[e].log_prob(zss[e]).sum(-1)
          _lpx_zs = [
              px_z.log_prob(x[d])
              .view(*px_z.batch_shape[:2], -1)
              .sum(-1)
              for d, px_z in enumerate(_px_zs)
          ]
          lws.append(
              [
                  log_mean_exp(_lpx_z + lpz - lqz_x).sum()
                  for _lpx_z in _lpx_zs
              ]
          )
      return lws
  
file_path: mmvae/src/report/calculate_likelihoods.py
imports: import os
  import sys
  import argparse
  import numpy
  import torch
  from torchvision.utils import save_image
  import inspect
  import models
  from utils import Logger, Timer, unpack_data, log_mean_exp
label_desc: Use image node_id 4 for calling a global function with example usage: cross_iwaes(qz_xs, px_zs, zss, x) and returns: lws