code: def forward(self, img1, img2):
      n_dim = len(img1.shape) - 2
      if min(img1.shape[-n_dim:]) < 4:
          weights = torch.FloatTensor([1.0]).to(img1.device)
  
      elif min(img1.shape[-n_dim:]) < 8:
          weights = torch.FloatTensor([0.3222, 0.6778]).to(img1.device)
  
      elif min(img1.shape[-n_dim:]) < 16:
          weights = torch.FloatTensor([0.4558, 0.1633, 0.3809]).to(
              img1.device
          )
  
      elif min(img1.shape[-n_dim:]) < 32:
          weights = torch.FloatTensor(
              [0.3117, 0.3384, 0.2675, 0.0824]
          ).to(img1.device)
  
      else:
          weights = torch.FloatTensor(
              [0.0448, 0.2856, 0.3001, 0.2363, 0.1333]
          ).to(img1.device)
      levels = weights.size()[0]
      mssim = []
      mcs = []
  
      pool_size = [2] * n_dim
      if n_dim == 2:
          pool_function = F.avg_pool2d
      elif n_dim == 3:
          pool_function = F.avg_pool3d
  
      for _ in range(levels):
          sim, cs = self.ssim(img1, img2)
          mssim.append(sim)
          mcs.append(cs)
  
          img1 = pool_function(img1, pool_size)
          img2 = pool_function(img2, pool_size)
  
      mssim = torch.stack(mssim)
      mcs = torch.stack(mcs)
  
      # Normalize (to avoid NaNs during training unstable models, not compliant with original
      # definition)
      mssim = (mssim + 1) / 2
      mcs = (mcs + 1) / 2
  
      pow1 = mcs**weights
      pow2 = mssim**weights
  
      output = torch.prod(pow1[:-1] * pow2[-1])
      return 1 - output
  
file_path: benchmark_VAE/src/pythae/models/msssim_vae/msssim_vae_utils.py
imports: import numpy
  import torch
  import torch.nn.functional
label_desc: Use image node_id 5 for calling the MSSSIM obj's underlying member method code with example usage: obj.forward(img1, img2) and returns: unknown