class_docstr: This is an implementation of WDGRL for video data.
code: def compute_loss(self, batch, split_name="valid"):
      # _s refers to source, _tu refers to unlabeled target
      x_s_rgb = x_tu_rgb = x_s_flow = x_tu_flow = None
      if self.rgb:
          if self.flow:  # For joint input
              (
                  (x_s_rgb, y_s),
                  (x_s_flow, y_s_flow),
                  (x_tu_rgb, y_tu),
                  (x_tu_flow, y_tu_flow),
              ) = batch
          else:  # For rgb input
              (x_s_rgb, y_s), (x_tu_rgb, y_tu) = batch
      else:  # For flow input
          (x_s_flow, y_s), (x_tu_flow, y_tu) = batch
  
      _, y_hat, [d_hat_rgb, d_hat_flow] = self.forward(
          {"rgb": x_s_rgb, "flow": x_s_flow}
      )
      _, y_t_hat, [d_t_hat_rgb, d_t_hat_flow] = self.forward(
          {"rgb": x_tu_rgb, "flow": x_tu_flow}
      )
      batch_size = len(y_s)
  
      # ok is abbreviation for (all) correct, dok refers to domain correct
      if self.rgb:
          _, dok_src_rgb = losses.cross_entropy_logits(
              d_hat_rgb, torch.zeros(batch_size)
          )
          _, dok_tgt_rgb = losses.cross_entropy_logits(
              d_t_hat_rgb, torch.ones(batch_size)
          )
      if self.flow:
          _, dok_src_flow = losses.cross_entropy_logits(
              d_hat_flow, torch.zeros(batch_size)
          )
          _, dok_tgt_flow = losses.cross_entropy_logits(
              d_t_hat_flow, torch.ones(batch_size)
          )
  
      if self.rgb and self.flow:  # For joint input
          dok = (
              torch.cat(
                  (dok_src_rgb, dok_src_flow, dok_tgt_rgb, dok_tgt_flow)
              )
              .double()
              .mean()
          )
          dok_src = (
              torch.cat((dok_src_rgb, dok_src_flow)).double().mean()
          )
          dok_tgt = (
              torch.cat((dok_tgt_rgb, dok_tgt_flow)).double().mean()
          )
          wasserstein_distance_rgb = (
              d_hat_rgb.mean()
              - (1 + self._beta_ratio) * d_t_hat_rgb.mean()
          )
          wasserstein_distance_flow = (
              d_hat_flow.mean()
              - (1 + self._beta_ratio) * d_t_hat_flow.mean()
          )
          wasserstein_distance = (
              wasserstein_distance_rgb + wasserstein_distance_flow
          ) / 2
      else:
          if self.rgb:  # For rgb input
              d_hat = d_hat_rgb
              d_t_hat = d_t_hat_rgb
              dok_src = dok_src_rgb
              dok_tgt = dok_tgt_rgb
          else:  # For flow input
              d_hat = d_hat_flow
              d_t_hat = d_t_hat_flow
              dok_src = dok_src_flow
              dok_tgt = dok_tgt_flow
  
          wasserstein_distance = (
              d_hat.mean() - (1 + self._beta_ratio) * d_t_hat.mean()
          )
          dok = torch.cat((dok_src, dok_tgt)).double().mean()
          dok_src = dok_src.double().mean()
          dok_tgt = dok_tgt.double().mean()
  
      loss_cls, ok_src = losses.cross_entropy_logits(y_hat, y_s)
      _, ok_tgt = losses.cross_entropy_logits(y_t_hat, y_tu)
      ok_src = ok_src.double().mean()
      ok_tgt = ok_tgt.double().mean()
  
      adv_loss = wasserstein_distance
      task_loss = loss_cls
  
      log_metrics = {
          f"{split_name}_source_acc": ok_src,
          f"{split_name}_target_acc": ok_tgt,
          f"{split_name}_domain_acc": dok,
          f"{split_name}_source_domain_acc": dok_src,
          f"{split_name}_target_domain_acc": dok_tgt,
          f"{split_name}_wasserstein_dist": wasserstein_distance,
      }
      return task_loss, adv_loss, log_metrics
  
imports: import torch
  import kale.predict.losses
  from kale.loaddata.video_access import get_image_modality
  from kale.pipeline.domain_adapter import BaseMMDLike, CDANTrainer, DANNTrainer, GradReverse, Method, set_requires_grad, WDGRLTrainer
label_desc: Use image node_id 3 for calling the WDGRLTrainerVideo obj's underlying member method code with example usage: obj.compute_loss(batch, split_name) and returns: task_loss,  adv_loss,  log_metrics