MCPcopy Create free account
hub / github.com/WuTao-CS/CustomCrafter / WrappedDataset

Class WrappedDataset

custom.py:294–304  ·  view source on GitHub ↗

Wraps an arbitrary object with __len__ and __getitem__ into a pytorch dataset

Source from the content-addressed store, hash-verified

292 return parser
293
294class WrappedDataset(Dataset):
295 """Wraps an arbitrary object with __len__ and __getitem__ into a pytorch dataset"""
296
297 def __init__(self, dataset):
298 self.data = dataset
299
300 def __len__(self):
301 return len(self.data)
302
303 def __getitem__(self, idx):
304 return self.data[idx]
305class ConcatDataset(Dataset):
306 def __init__(self, *datasets):
307 self.datasets = datasets

Callers 1

setupMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected