MCPcopy
hub / github.com/dmlc/dgl / _decompose_one_dimension

Function _decompose_one_dimension

python/dgl/dataloading/dataloader.py:245–252  ·  view source on GitHub ↗
(length, world_size, rank, drop_last)

Source from the content-addressed store, hash-verified

243
244
245def _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
255class DDPTensorizedDataset(torch.utils.data.IterableDataset):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected