RangeBatchSampler¶
- class lightkit.data.RangeBatchSampler(sampler, batch_size, drop_last=False)[source]¶
Bases:
torch.utils.data.sampler.Sampler
[range
]Sampler providing batches of contiguous indices.
This sampler can be used with
lightkit.data.DataLoader
to provide significant speedups for tensor datasets.- Parameters
sampler (
Sampler
[int
]) -- The sampler providing indices. Must be a sequential sampler. Note that the only purpose of this sampler is to determine its length.batch_size (
int
) -- The number of items to sample for each batch.drop_last (
bool
) -- Whether to drop the last batch ifnum_items
is not divisible bybatch_size
.
Methods
Inherited Methods