Create sampler for the given dataset. Args: dataset (torch.utils.data.Dataset): the given dataset. shuffle (bool): set to ``True`` to have the data reshuffled at every epoch. cfg (CfgNode): configs. Details can be found in slowfast/config/defa
(dataset, shuffle, cfg)
| 398 | |
| 399 | |
| 400 | def create_sampler(dataset, shuffle, cfg): |
| 401 | """ |
| 402 | Create sampler for the given dataset. |
| 403 | Args: |
| 404 | dataset (torch.utils.data.Dataset): the given dataset. |
| 405 | shuffle (bool): set to ``True`` to have the data reshuffled |
| 406 | at every epoch. |
| 407 | cfg (CfgNode): configs. Details can be found in |
| 408 | slowfast/config/defaults.py |
| 409 | Returns: |
| 410 | sampler (Sampler): the created sampler. |
| 411 | """ |
| 412 | sampler = DistributedSampler(dataset) if cfg.NUM_GPUS >= 1 else None |
| 413 | |
| 414 | return sampler |
| 415 | |
| 416 | |
| 417 | def loader_worker_init_fn(dataset): |
nothing calls this directly
no outgoing calls
no test coverage detected