code: def loss(
      self,
      x,
      x_,
      mu_qz,
      logvar_qz,
      mu_qhx,
      logvar_qhx,
      mu_qhy,
      logvar_qhy,
      mu_ph,
      logvar_ph,
      beta,
      alpha_1,
      alpha_2,
  ):
      # Likelihood
      ll_choices = {
          "mult": x * torch.log(x_ + EPS),
          "bern": x * torch.log(x_ + EPS)
          + (1 - x) * torch.log(1 - x_ + EPS),
          "gaus": -((x - x_) ** 2),
          "pois": x * torch.log(x_ + EPS) - x_,
      }
  
      ll = ll_choices.get(self.likelihood, None)
      if ll is None:
          raise ValueError(
              "Supported likelihoods: {}".format(ll_choices.keys())
          )
  
      ll = torch.sum(ll, dim=1)
  
      # KL term z
      std_qz = torch.exp(0.5 * logvar_qz)
      kld_z = -0.5 * (
          1 + 2.0 * torch.log(std_qz) - mu_qz.pow(2) - std_qz.pow(2)
      )
      kld_z = torch.sum(kld_z, dim=1)
  
      # KL term h
      std_qhx = torch.exp(0.5 * logvar_qhx)
      std_qhy = torch.exp(0.5 * logvar_qhy)
      std_ph = torch.exp(0.5 * logvar_ph)
  
      # KL(q(h|x)||p(h|x))
      kld_hx = -0.5 * (
          1
          + 2.0 * torch.log(std_qhx)
          - (mu_qhx - mu_ph).pow(2)
          - std_qhx.pow(2)
      )  # assuming std_ph is 1 for now
      kld_hx = torch.sum(kld_hx, dim=1)
  
      # KL(q(h|x)||q(h|y))
      kld_hy = -0.5 * (
          1
          + 2.0 * torch.log(std_qhx)
          - 2.0 * torch.log(std_qhy)
          - ((mu_qhx - mu_qhy).pow(2) + std_qhx.pow(2)) / std_qhy.pow(2)
      )  # assuming std_ph is 1 for now
      kld_hy = torch.sum(kld_hy, dim=1)
  
      return torch.mean(
          beta * kld_z + alpha_1 * kld_hx + alpha_2 * kld_hy - ll
      )
  
file_path: cornac/cornac/models/cvaecf/cvaecf.py
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from tqdm.auto import trange
  from ...utils import estimate_batches
label_desc: Use image node_id 9 for calling the CVAE obj's underlying member method code with example usage: obj.loss(x, x_, mu_qz, logvar_qz, mu_qhx, logvar_qhx, mu_qhy, logvar_qhy, mu_ph, logvar_ph, beta, alpha_1, alpha_2) and returns: torch