MCPcopy Create free account
hub / github.com/OpenGVLab/EfficientQAT / __getitem__

Method __getitem__

datautils_block.py:261–269  ·  view source on GitHub ↗
(self, idx)

Source from the content-addressed store, hash-verified

259 return self.size//self.batch_size
260
261 def __getitem__(self, idx):
262 if idx >= self.__len__():
263 raise IndexError("Index out of range")
264 if self.off_load_to_disk:
265 filepath = self._get_file_path(idx)
266 tensor = torch.load(filepath)
267 else:
268 tensor = self.data[idx]
269 return tensor
270
271 def update_data(self, idx, new_data):
272 if self.off_load_to_disk:

Callers

nothing calls this directly

Calls 2

__len__Method · 0.95
_get_file_pathMethod · 0.95

Tested by

no test coverage detected