MCPcopy Create free account
hub / github.com/dcharatan/flowmap / __getitem__

Method __getitem__

flowmap/dataset/validation_wrapper.py:25–32  ·  view source on GitHub ↗
(self, index: int)

Source from the content-addressed store, hash-verified

23 return self.length
24
25 def __getitem__(self, index: int):
26 if isinstance(self.dataset, IterableDataset):
27 if self.dataset_iterator is None:
28 self.dataset_iterator = iter(self.dataset)
29 return next(self.dataset_iterator)
30
31 random_index = torch.randint(0, len(self.dataset), tuple())
32 return self.dataset[random_index.item()]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected