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

Function _split_to_local_id_tensor

python/dgl/dataloading/dataloader.py:158–169  ·  view source on GitHub ↗
(indices, local_lower_bound, local_upper_bound)

Source from the content-addressed store, hash-verified

156
157
158def _split_to_local_id_tensor(indices, local_lower_bound, local_upper_bound):
159 dtype = dtype_of(indices)
160 device = indices.device
161 num_samples = local_upper_bound - local_lower_bound
162 id_tensor = torch.empty(num_samples, dtype=dtype, device=device)
163
164 if local_upper_bound > len(indices):
165 remainder = len(indices) - local_lower_bound
166 id_tensor[0:remainder] = indices[local_lower_bound:]
167 else:
168 id_tensor = indices[local_lower_bound:local_upper_bound]
169 return id_tensor
170
171
172def _divide_by_worker(dataset, batch_size, drop_last):

Callers 1

__init__Method · 0.85

Calls 1

dtype_ofFunction · 0.85

Tested by

no test coverage detected