Function
_decompose_one_dimension
(length, world_size, rank, drop_last)
Source from the content-addressed store, hash-verified
| 243 | |
| 244 | |
| 245 | def _decompose_one_dimension(length, world_size, rank, drop_last): |
| 246 | if drop_last: |
| 247 | num_samples = math.floor(length / world_size) |
| 248 | else: |
| 249 | num_samples = math.ceil(length / world_size) |
| 250 | sta = rank * num_samples |
| 251 | end = (rank + 1) * num_samples |
| 252 | return sta, end |
| 253 | |
| 254 | |
| 255 | class DDPTensorizedDataset(torch.utils.data.IterableDataset): |
Tested by
no test coverage detected