LRSampler
- class jlpy.pytorch.base.linear_regression.base_impl.LRSampler
-
A custom torch batched Sampler - LRSampler.
- Custom Sampler:
Controlling how to shuffle.
Return the size for iteration.
- Custom batched sampler:
Control how to shuffle.
Control batch size.
Control the drop_last.
Return the size for batched iteration.
- Sampler __iter__():
Return a list of indices.
Using the list of indices to get elements from Dataset class.
Sampler will call __getitems__() first, then fall back to call __getitem__().
- Dataset class:
Sampler class only need to get the len of the dataset.
According to the len of the dataset, Sampler will procee all the rest itself.
Dataloader will iterate the Sampler and get the samples from Dataset.
Methods
Construct a class instance.