torchrecurrent.benchmarks.sequential_cifar10#

torchrecurrent.benchmarks.sequential_cifar10(images, targets, permutation=None, return_dataloader=True, batch_size=64, shuffle=True, *, normalize=True, dtype=None, device=None, generator=None, **dataloader_kwargs)[source]#

Convert CIFAR-10 tensors into the sequential or permuted-CIFAR task.

Every 32 by 32 RGB image becomes a sequence of 1024 three-channel pixel inputs in raster-scan order. With a permutation, the same fixed pixel ordering is applied to every image, mirroring the permuted-MNIST protocol of Arjovsky et al. (2016), Section 5.3 (https://proceedings.mlr.press/v48/arjovsky16.html). This function extends that pixel-by-pixel/permuted protocol to CIFAR-10; it is not itself drawn from a specific paper’s CIFAR-10 experiment. The caller supplies the CIFAR-10 tensors so this package does not require a dataset-download dependency.

Parameters:
  • images – CIFAR-10 images with shape (N, 32, 32, 3) or (N, 3, 32, 32).

  • targets – Class indices with shape (N,).

  • permutation – Optional permutation of the integers from 0 through 1023. Reuse the same tensor for training and test data.

  • return_dataloader – Return a data loader when true, otherwise tensors.

  • batch_size – Batch size of the returned data loader.

  • shuffle – Whether the returned data loader shuffles samples.

  • normalize – Convert integer pixels from [0, 255] to [0, 1]. Floating-point inputs are assumed to be normalized already.

  • dtype – Floating-point dtype of the returned inputs. Defaults to the current PyTorch default dtype.

  • device – Device on which to place inputs and targets.

  • generator – Optional generator used by the data loader when shuffling.

  • **dataloader_kwargs – Additional arguments passed to torch.utils.data.DataLoader.

Returns:

A data loader, or (sequences, targets) when return_dataloader=False. Sequences have shape (N, 1024, 3) and targets have shape (N,) with dtype torch.long.