TFRecordReader

class dragon.vm.dali.ops.TFRecordReader(
  path,
  shard_id=0,
  num_shards=1,
  random_shuffle=False,
  initial_fill=1024,
  **kwargs
)[source]

Read examples from the TFRecord.

Examples:

# Assume the we have the following data:
# /data/00001.data
# /data/00001.index
# /data/FEATURES
database = '/data'
input = dali.ops.TFRecordReader(
    path=database,
    # Shuffle locally in the next ``initial_fill`` examples
    # It turns to be weak with the decreasing of ``initial_fill``
    # and disabled if ``initial_fill`` is set to **1**
    random_shuffle=True,
    initial_fill=1024,
)

__new__

static TFRecordReader.__new__(
  cls,
  path,
  shard_id=0,
  num_shards=1,
  random_shuffle=False,
  initial_fill=1024,
  **kwargs
)[source]

Create a TFRecordReader.

Parameters:
  • path (str) – The folder of record files.
  • shard_id (int, optional, default=0) – The index of partition to read.
  • num_shards (int, optional, default=1) – The total number of partitions over dataset.
  • random_shuffle (bool, optional, default=False) – Whether to shuffle the data.
  • initial_fill (int, optional, default=1024) – The length of sampling sequence for shuffle.
Returns:

nvidia.dali.ops.TFRecordReader – The reader instance.