# tensorplay.distributed.elastic.utils.data API Source: https://www.tensorplay.cn/docs/api/tensorplay.distributed.elastic.utils.data.html ## Classes 2 [#](#api-tensorplay.distributed.elastic.utils.data.CyclingIterator) ### CyclingIterator class[Full reference ↗](/docs/generated/tensorplay.distributed.elastic.utils.data.CyclingIterator.html) ```python class tensorplay.distributed.elastic.utils.data.CyclingIterator(*args, start_epoch: int = 0, n: int | None = None, generator_fn=None) ``` Wrap a finite iterable into an endless one. Each cycle increments epoch; the underlying iterable is re-materialized through its factory (or by calling iter on it again when it supports that) so per-epoch shuffling keeps working. ```python property epoch: int ``` Epoch number of the data currently being produced. [#](#api-tensorplay.distributed.elastic.utils.data.ElasticDistributedSampler) ### ElasticDistributedSampler class[Full reference ↗](/docs/generated/tensorplay.distributed.elastic.utils.data.ElasticDistributedSampler.html) ```python class tensorplay.distributed.elastic.utils.data.ElasticDistributedSampler(dataset, *, start_rank: int = 0, start_epoch: int = 0) ``` Sampler for elastic jobs where num_replicas may change per epoch. Unlike a fixed-shard distributed sampler, this one derives the covered range from the epoch number so restarting with a different world size never skips or repeats data beyond the wrap-around tail.