MCPcopy Create free account
hub / github.com/FreeformRobotics/OTS / __init__

Method __init__

lib/utils/data/distributed.py:25–35  ·  view source on GitHub ↗
(self, dataset, num_replicas=None, rank=None)

Source from the content-addressed store, hash-verified

23 """
24
25 def __init__(self, dataset, num_replicas=None, rank=None):
26 if num_replicas is None:
27 num_replicas = get_world_size()
28 if rank is None:
29 rank = get_rank()
30 self.dataset = dataset
31 self.num_replicas = num_replicas
32 self.rank = rank
33 self.epoch = 0
34 self.num_samples = int(math.ceil(len(self.dataset) * 1.0 / self.num_replicas))
35 self.total_size = self.num_samples * self.num_replicas
36
37 def __iter__(self):
38 # deterministically shuffle based on epoch

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected