(num_train_classes, num_valid_classes, num_test_classes)
return train_inds.tolist(), valid_inds.tolist(), test_inds.tolist()
Generates a random set of indices corresponding to dataset splits.

  It assumes the indices go from [0, num_classes), where the num_classes =
  num_train_classes + num_val_classes + num_test_classes. The returned indices
  are non-overlapping and cover the entire range.

  Note that in the current implementation, valid_inds and test_inds are sorted,
  but train_inds is in random order.

  Args:
    num_train_classes : int, number of (meta)-training classes.
    num_valid_classes : int, number of (meta)-valid classes.
    num_test_classes : int, number of (meta)-test classes.

  Returns:
    train_inds : np array of training inds.
    valid_inds : np array of valid inds.
    test_inds  : np array of test inds.
Generates a random set of indices corresponding to dataset splits.
Generates a random set of indices corresponding to dataset splits .
def gen_rand_split_inds(num_train_classes, num_valid_classes, num_test_classes):
  """Generates a random set of indices corresponding to dataset splits.

  It assumes the indices go from [0, num_classes), where the num_classes =
  num_train_classes + num_val_classes + num_test_classes. The returned indices
  are non-overlapping and cover the entire range.

  Note that in the current implementation, valid_inds and test_inds are sorted,
  but train_inds is in random order.

  Args:
    num_train_classes : int, number of (meta)-training classes.
    num_valid_classes : int, number of (meta)-valid classes.
    num_test_classes : int, number of (meta)-test classes.

  Returns:
    train_inds : np array of training inds.
    valid_inds : np array of valid inds.
    test_inds  : np array of test inds.
  """
  num_trainval_classes = num_train_classes + num_valid_classes
  num_classes = num_trainval_classes + num_test_classes

  # First split into trainval and test splits.
  trainval_inds = np.random.choice(
      num_classes, num_trainval_classes, replace=False)
  test_inds = np.setdiff1d(np.arange(num_classes), trainval_inds)
  # Now further split trainval into train and val.
  train_inds = np.random.choice(trainval_inds, num_train_classes, replace=False)
  valid_inds = np.setdiff1d(trainval_inds, train_inds)

  logging.info(
      'Created splits with %d train, %d validation and %d test classes.',
      len(train_inds), len(valid_inds), len(test_inds))
  return train_inds.tolist(), valid_inds.tolist(), test_inds.tolist()
def gen_rand_split_inds ( num_train_classes , num_valid_classes , num_test_classes ) : num_trainval_classes = num_train_classes + num_valid_classes num_classes = num_trainval_classes + num_test_classes # First split into trainval and test splits. trainval_inds = np . random . choice ( num_classes , num_trainval_classes , replace = False ) test_inds = np . setdiff1d ( np . arange ( num_classes ) , trainval_inds ) # Now further split trainval into train and val. train_inds = np . random . choice ( trainval_inds , num_train_classes , replace = False ) valid_inds = np . setdiff1d ( trainval_inds , train_inds ) logging . info ( 'Created splits with %d train, %d validation and %d test classes.' , len ( train_inds ) , len ( valid_inds ) , len ( test_inds ) ) return train_inds . tolist ( ) , valid_inds . tolist ( ) , test_inds . tolist ( )