MCPcopy
hub / github.com/TencentARC/Pixal3D / cycle

Function cycle

pixal3d/utils/data_utils.py:50–60  ·  view source on GitHub ↗
(data_loader: DataLoader)

Source from the content-addressed store, hash-verified

48
49
50def cycle(data_loader: DataLoader) -> Iterator:
51 while True:
52 for data in data_loader:
53 if isinstance(data_loader.sampler, ResumableSampler):
54 data_loader.sampler.idx += data_loader.batch_size # type: ignore[attr-defined]
55 yield data
56 if isinstance(data_loader.sampler, DistributedSampler):
57 data_loader.sampler.epoch += 1
58 if isinstance(data_loader.sampler, ResumableSampler):
59 data_loader.sampler.epoch += 1
60 data_loader.sampler.idx = 0
61
62
63class ResumableSampler(Sampler):

Callers 4

prepare_dataloaderMethod · 0.85
prepare_dataloaderMethod · 0.85
prepare_dataloaderMethod · 0.85
prepare_dataloaderMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected