Interface Dataset

All Known Implementing Classes:
Cifar10, Mnist

public interface Dataset
An in-memory labelled dataset of fixed-shape samples (CHW images or flat vectors).
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    batch(int b, int size, float[] x, int[] y)
    Copies batch b of size samples, in dataset order, into x and y.
    int
    The number of samples.
    static Dataset
    of(float[] x, int[] y, int... sampleShape)
    A dataset over arrays: x holds the samples back to back, y one label each.
    default void
    sample(int i, float[] x, int xAt, int[] y, int yAt)
    Copies sample i into x at xAt and its label into y at yAt (DataLoader assembles shuffled batches with it).
    int[]
    The shape of one sample, e.g. {1, 28, 28} or {3, 32, 32}.
    default int
    The number of values in one sample: the product of sampleShape().
  • Method Details

    • count

      int count()
      The number of samples.
    • sampleShape

      int[] sampleShape()
      The shape of one sample, e.g. {1, 28, 28} or {3, 32, 32}.
    • batch

      void batch(int b, int size, float[] x, int[] y)
      Copies batch b of size samples, in dataset order, into x and y.
    • sample

      default void sample(int i, float[] x, int xAt, int[] y, int yAt)
      Copies sample i into x at xAt and its label into y at yAt (DataLoader assembles shuffled batches with it). The default copies through batch(int, int, float[], int[]) of size 1.
    • sampleSize

      default int sampleSize()
      The number of values in one sample: the product of sampleShape().
    • of

      static Dataset of(float[] x, int[] y, int... sampleShape)
      A dataset over arrays: x holds the samples back to back, y one label each.