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

Method __init__

PATH/core/distributed_utils.py:1017–1031  ·  view source on GitHub ↗
(self, sampler, batch_size, drop_last)

Source from the content-addressed store, hash-verified

1015 """
1016
1017 def __init__(self, sampler, batch_size, drop_last):
1018 # Since collections.abc.Iterable does not check for `__getitem__`, which
1019 # is one way for an object to be an iterable, we don't do an `isinstance`
1020 # check here.
1021 if not isinstance(batch_size, int) or isinstance(batch_size, bool) or \
1022 batch_size <= 0:
1023 raise ValueError("batch_size should be a positive integer value, "
1024 "but got batch_size={}".format(batch_size))
1025 if not isinstance(drop_last, bool):
1026 raise ValueError("drop_last should be a boolean value, but got "
1027 "drop_last={}".format(drop_last))
1028 self.sampler = sampler
1029 self.batch_size = batch_size
1030 self.drop_last = drop_last
1031 self.flag = self.sampler.flag
1032
1033 def __iter__(self):
1034 ret = []

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected