MCPcopy Create free account
hub / github.com/pytorch/pytorch / __iter__

Method __iter__

torch/utils/data/sampler.py:237–239  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

235 self.generator = generator
236
237 def __iter__(self) -> Iterator[int]:
238 rand_tensor = torch.multinomial(self.weights, self.num_samples, self.replacement, generator=self.generator)
239 yield from iter(rand_tensor.tolist())
240
241 def __len__(self) -> int:
242 return self.num_samples

Callers

nothing calls this directly

Calls 2

iterFunction · 0.85
tolistMethod · 0.45

Tested by

no test coverage detected