class_docstr: Moment matching for multi-source domain adaptation (M3SDA).
  
  Reference:
      Peng, X., Bai, Q., Xia, X., Huang, Z., Saenko, K., & Wang, B. (2019). Moment matching for multi-source
      domain adaptation. In Proceedings of the IEEE/CVF International Conference on Computer Vision
      (pp. 1406-1415).
      https://openaccess.thecvf.com/content_ICCV_2019/html/Peng_Moment_Matching_for_Multi-Source_Domain_Adaptation_ICCV_2019_paper.html
docstr: Compute the k-th order moment divergence
  
  Args:
      x (torch.Tensor): input data, shape (n_samples, n_features)
      domain_labels (torch.Tensor): labels indicating which domain the instance is from, shape (n_samples,)
  
  Returns:
      torch.Tensor: divergence
docstr_tok: ["Compute","the","k-th","order","moment","divergence","Args",":","x","(","torch.Tensor",")",":","input","data",",","shape","(","n_samples",",","n_features",")","domain_labels","(","torch.Tensor",")",":","labels","indicating","which","domain","the","instance","is","from",",","shape","(","n_samples",",",")","Returns",":","torch.Tensor",":","divergence"]
code: def _compute_domain_dist(self, x, domain_labels):
      """Compute the k-th order moment divergence
  
      Args:
          x (torch.Tensor): input data, shape (n_samples, n_features)
          domain_labels (torch.Tensor): labels indicating which domain the instance is from, shape (n_samples,)
  
      Returns:
          torch.Tensor: divergence
      """
  
      moment_loss = 0
      for i in range(self.k_moment):
          moment_loss += losses._moment_k(x, domain_labels, i + 1)
  
      return moment_loss
  
imports: import torch
  import torch.nn
  from sklearn.base import BaseEstimator, ClassifierMixin
  from sklearn.metrics.pairwise import pairwise_kernels
  from sklearn.preprocessing import LabelBinarizer
  from torch.linalg import multi_dot
  from torch.nn.functional import one_hot
  import kale.predict.losses
  from kale.embed.image_cnn import _Bottleneck
  from kale.pipeline.domain_adapter import BaseAdaptTrainer
label_desc: Use image node_id 4 for calling the M3SDATrainer obj's underlying member method code with example usage: obj._compute_domain_dist(x, domain_labels) and returns: moment_loss