(data_loader: DataLoader)
| 48 | |
| 49 | |
| 50 | def 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 | |
| 63 | class ResumableSampler(Sampler): |
no outgoing calls
no test coverage detected