grain.experimental.WindowShuffleMapDataset

grain.experimental.WindowShuffleMapDataset#

class grain.experimental.WindowShuffleMapDataset(parent, *, window_size, seed)#

Shuffles the parent dataset within a given window.

Shuffles the retrieval index within a range, given by window_size. Each unique index corresponds to exactly one shuffled index (i.e. there is a one-to-one mapping and hence a guarantee that no shuffled indices are repeated within a given window).

Parameters:
__init__(parent, *, window_size, seed)#
Parameters:
  • parent (MapDataset)

  • window_size (int)

  • seed (int)

Methods

__init__(parent, *, window_size, seed)

apply(transformations)

Returns a dataset with the given transformation(s) applied.

batch(batch_size, *[, drop_remainder, batch_fn])

Returns a dataset of elements batched along a new first dimension.

filter(transform)

Returns a dataset containing only the elements that match the filter.

map(transform)

Returns a dataset containing the elements transformed by transform.

map_with_index(transform)

Returns a dataset containing the elements transformed by transform.

pipe(func, /, *args, **kwargs)

Syntactic sugar for applying a callable to this dataset.

random_map(transform, *[, seed])

Returns a dataset containing the elements transformed by transform.

repeat([num_epochs, reseed_each_epoch])

Returns a dataset repeating the elements of this dataset multiple times.

seed(seed)

Returns a dataset that uses the seed for default seed generation.

shuffle([seed])

Returns a dataset with the same elements in a globally shuffled order.

slice(sl)

Returns a dataset containing only the elements with indices in sl.

to_iter_dataset([read_options, allow_nones])

Converts this dataset to an IterDataset.

Attributes

parents