code: def __init__(
      self,
      datasets,
      batch_size_pairs,
      batch_size_triplets=None,
      dataset_size_temp=-1,
  ):
      self.allow_swap = True
      self.batch_size_pairs = batch_size_pairs
      self.batch_size_triplets = (
          batch_size_pairs
          if batch_size_triplets is None
          else batch_size_triplets
      )
  
      # Compute dataset weights
      self.dataset_lengths = list(map(len, datasets))
      self.dataset_lengths_sum = sum(self.dataset_lengths)
  
      weights = []
      if dataset_size_temp > 0:  # Scale probability with dataset size
          for dataset in datasets:
              prob = len(dataset) / self.dataset_lengths_sum
              weights.append(
                  max(
                      1,
                      int(math.pow(prob, 1 / dataset_size_temp) * 1000),
                  )
              )
      else:  # Equal weighting of all datasets
          weights = [100] * len(datasets)
  
      logging.info(
          "Dataset lengths and weights: {}".format(
              list(zip(self.dataset_lengths, weights))
          )
      )
  
      self.dataset_idx = []
      self.dataset_idx_pointer = 0
  
      for idx, weight in enumerate(weights):
          self.dataset_idx.extend([idx] * weight)
      random.shuffle(self.dataset_idx)
  
      self.datasets = []
      for dataset in datasets:
          random.shuffle(dataset)
          self.datasets.append(
              {
                  "elements": dataset,
                  "pointer": 0,
              }
          )
  
imports: import math
  import logging
  import random
label_desc: Use image node_id 1 to create a new MultiDatasetDataLoader object  with example: obj = MultiDatasetDataLoader(datasets, batch_size_pairs, batch_size_triplets, dataset_size_temp)