MCPcopy Create free account
hub / github.com/geekcomputers/Python / __getitem__

Method __getitem__

ML/src/python/neuralforge/data/dataset.py:144–153  ·  view source on GitHub ↗
(self, idx: int)

Source from the content-addressed store, hash-verified

142 return len(self.dataset)
143
144 def __getitem__(self, idx: int) -> Tuple[torch.Tensor, int]:
145 if idx in self.cache:
146 return self.cache[idx]
147
148 item = self.dataset[idx]
149
150 if len(self.cache) < self.cache_size:
151 self.cache[idx] = item
152
153 return item
154
155class MultiScaleDataset(Dataset):
156 def __init__(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected