code: def compute_mmd_loss(kernel_values, batch_size):
      """Computes the Maximum Mean Discrepancy (MMD) between domains.
  
      Examples:
          See DANTrainer and JANTrainer in kale.pipeline.domain_adapter
      """
      loss = 0
      for i in range(batch_size):
          s1, s2 = i, (i + 1) % batch_size
          t1, t2 = s1 + batch_size, s2 + batch_size
          loss += kernel_values[s1, s2] + kernel_values[t1, t2]
          loss -= kernel_values[s1, t2] + kernel_values[s2, t1]
      return loss / float(batch_size)
  
file_path: pykale/kale/predict/losses.py
imports: import torch
  import torch.nn
  from torch.autograd import grad
  from torch.nn import functional
label_desc: Use image node_id 8 for calling a global function with example usage: compute_mmd_loss(kernel_values, batch_size) and returns: unknown