matchzoo.dataloader.sampler¶
Sampler class for dataloader.
Module Contents¶
-
class
matchzoo.dataloader.sampler.SequentialSampler(dataset: Dataset)¶ Bases:
torch.utils.data.SamplerSamples 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.SamplerSamples 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.SamplerSamples 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.SamplerWraps 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.