MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / __iter__

Method __iter__

tensorpack/dataflow/common.py:483–493  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

481 return sum(self.sizes)
482
483 def __iter__(self):
484 sums = np.cumsum(self.sizes)
485 idxs = np.arange(self.__len__())
486 self.rng.shuffle(idxs)
487 idxs = np.array(list(map(
488 lambda x: np.searchsorted(sums, x, 'right'), idxs)))
489 itrs = [k.__iter__() for k in self.df_lists]
490 assert idxs.max() == len(itrs) - 1, "{}!={}".format(idxs.max(), len(itrs) - 1)
491 for k in idxs:
492 yield next(itrs[k])
493 # TODO run till exception
494
495
496class ConcatData(DataFlow):

Callers

nothing calls this directly

Calls 4

__len__Method · 0.95
maxMethod · 0.80
formatMethod · 0.80
__iter__Method · 0.45

Tested by

no test coverage detected