class_docstr: Domain independent network (DIN). It is under development and will be updated with references later.
code: def _compute_domain_dist(self, x, domain_labels):
      if self.kernel == "linear":
          kx = torch.mm(x, x.T)
      else:
          raise ValueError(
              "Other kernels have not been implemented yet!"
          )
      domain_label_mat = one_hot(
          domain_labels, num_classes=self.n_domains
      )
      domain_label_mat = domain_label_mat.float()
      ky = torch.mm(domain_label_mat, domain_label_mat.T)
      return losses.hsic(kx, ky, device=self.device)
  
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 3 for calling the _DINTrainer obj's underlying member method code with example usage: obj._compute_domain_dist(x, domain_labels) and returns: losses