matchzoo.dataloader.sampler

Sampler class for dataloader.

Module Contents

class matchzoo.dataloader.sampler.SequentialSampler(dataset:Dataset)

Bases: torch.utils.data.Sampler

Samples elements sequentially, always in the same order.

Parameters:dataset – The dataset to sample from.
__iter__(self)

Get the indices of a batch.

__len__(self)

Get the total number of instances.

class matchzoo.dataloader.sampler.SortedSampler(dataset:Dataset)

Bases: torch.utils.data.Sampler

Samples elements according to length_right.

Parameters:dataset – The dataset to sample from.
__iter__(self)

Get the indices of a batch.

__len__(self)

Get the total number of instances.

class matchzoo.dataloader.sampler.RandomSampler(dataset:Dataset)

Bases: torch.utils.data.Sampler

Samples elements randomly.

Parameters:dataset – The dataset to sample from.
__iter__(self)

Get the indices of a batch.

__len__(self)

Get the total number of instances.

class matchzoo.dataloader.sampler.BatchSampler(sampler:Sampler, batch_size:int=32)

Bases: torch.utils.data.Sampler

Wraps another sampler to yield the indices of a batch.

Parameters:
  • sampler – Base sampler.
  • batch_size – Size of a batch.
__iter__(self)

Get the indices of a batch.

__len__(self)

Get the total number of batch.