code: def random_pairs_of_minibatches(minibatches):
      perm = torch.randperm(len(minibatches)).tolist()
      pairs = []
  
      for i in range(len(minibatches)):
          j = i + 1 if i < (len(minibatches) - 1) else 0
  
          xi, yi = minibatches[perm[i]][0], minibatches[perm[i]][1]
          xj, yj = minibatches[perm[j]][0], minibatches[perm[j]][1]
  
          min_n = min(len(xi), len(xj))
  
          pairs.append(
              ((xi[:min_n], yi[:min_n]), (xj[:min_n], yj[:min_n]))
          )
  
      return pairs
  
imports: import hashlib
  import operator
  import sys
  from collections import Counter
  from collections import OrderedDict
  from datetime import datetime
  from numbers import Number
  import numpy
  import torch
label_desc: Use image node_id 11 for calling a global function with example usage: random_pairs_of_minibatches(minibatches) and returns: pairs