MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / __len__

Method __len__

PATH/core/distributed_utils.py:1052–1060  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1050 return iter(ret)
1051
1052 def __len__(self):
1053 # Can only be called if self.sampler has __len__ implemented
1054 # We cannot enforce this condition, so we turn off typechecking for the
1055 # implementation below.
1056 # Somewhat related: see NOTE [ Lack of Default `__len__` in Python Abstract Base Classes ]
1057 if self.drop_last:
1058 return len(self.sampler) // self.batch_size
1059 else:
1060 return (len(self.sampler) + self.batch_size - 1) // self.batch_size
1061
1062class DistributedSequentialSampler(Sampler):
1063 def __init__(self, dataset, world_size=None, rank=None):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected