|
Safemotion Lib
|
Public Member Functions | |
| __init__ (self, int size, bool shuffle=True, Optional[int] seed=None) | |
| __iter__ (self) | |
Protected Member Functions | |
| _infinite_indices (self) | |
Protected Attributes | |
| _size | |
| _shuffle | |
| _seed | |
| _rank | |
| _world_size | |
In training, we only care about the "infinite stream" of training data. So this sampler produces an infinite stream of indices and all workers cooperate to correctly shuffle the indices and sample different indices. The samplers in each worker effectively produces `indices[worker_id::num_workers]` where `indices` is an infinite stream of indices consisting of `shuffle(range(size)) + shuffle(range(size)) + ...` (if shuffle is True) or `range(size) + range(size) + ...` (if shuffle is False)
Definition at line 15 of file data_sampler.py.
| fastreid.data.samplers.data_sampler.TrainingSampler.__init__ | ( | self, | |
| int | size, | ||
| bool | shuffle = True, | ||
| Optional[int] | seed = None ) |
Args:
size (int): the total number of data of the underlying dataset to sample from
shuffle (bool): whether to shuffle the indices or not
seed (int): the initial seed of the shuffle. Must be the same
across all workers. If None, will use a random seed shared
among workers (require synchronization among all workers).
Definition at line 26 of file data_sampler.py.
| fastreid.data.samplers.data_sampler.TrainingSampler.__iter__ | ( | self | ) |
Definition at line 45 of file data_sampler.py.
|
protected |
Definition at line 49 of file data_sampler.py.
|
protected |
Definition at line 42 of file data_sampler.py.
|
protected |
Definition at line 40 of file data_sampler.py.
|
protected |
Definition at line 37 of file data_sampler.py.
|
protected |
Definition at line 35 of file data_sampler.py.
|
protected |
Definition at line 43 of file data_sampler.py.