peal.data.dataloaders.create_class_ordered_batch

peal.data.dataloaders.create_class_ordered_batch(dataset, config)[source]

Build a small batch with two consecutive samples of every class.

Parameters:
  • dataset (PealDataset or DataLoader) – Source handed to DataStack.

  • config (object) – Config whose task.output_size (or data.output_size) gives the number of classes.

Returns:

(X, y) with 2 * output_size samples ordered by class.

Return type:

tuple of torch.Tensor