MCPcopy Create free account
hub / github.com/RingBDStack/GDAP / __iter__

Method __iter__

seq2seq/utils.py:393–401  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

391 self.shuffle = shuffle
392
393 def __iter__(self) -> Iterable:
394 g = torch.Generator()
395 g.manual_seed(self.epoch)
396
397 sortish_data = [self.dataset.src_lens[i] for i in self.available_indices]
398 sortish_indices = sortish_sampler_indices(sortish_data, self.batch_size, shuffle=self.shuffle)
399 indices = [self.available_indices[i] for i in sortish_indices]
400 assert len(indices) == self.num_samples
401 return iter(indices)
402
403 @cached_property
404 def available_indices(self) -> np.array:

Callers

nothing calls this directly

Calls 1

sortish_sampler_indicesFunction · 0.85

Tested by

no test coverage detected