Class Record

java.lang.Object
ai.djl.training.dataset.Record

public class Record extends Object
Record represents a single element of data and labels from Dataset.

The data and labels in record are in the form of an NDList. This allows it to hold multiple types of data and labels. However, note that the NDList does not include a dimension for batch.

In a Record, data and label are each an NDList. The data NDList represents the data for each input in the batch. Similarly, the label NDList represents the labels for each output.

For example, an Image Question and Answer dataset has two inputs: an image and a question. In this case, the data in the Record will be an NDList containing a CHW image NDArray and a TC question NDArray. The label will be an NDList containing only a TC answer NDArray.

In order to differentiate a batch vs a single record (despite them both consisting of two NDLists), we have the Batch and the Record classes respectively.

  • Constructor Details

    • Record

      public Record(NDList data, NDList labels)
      Creates a new instance of Record with a single element of data and its corresponding labels.
      Parameters:
      data - an NDList that contains a single element of data
      labels - an NDList that contains the corresponding label
  • Method Details

    • getData

      public NDList getData()
      Gets the data of this Record.
      Returns:
      an NDList that contains the data of this Record
    • getLabels

      public NDList getLabels()
      Gets the labels that correspond to the data of this Record.
      Returns:
      an NDList that contains label that correspond to the data of this Record