MCPcopy Create free account
hub / github.com/Monalissaa/DisenDiff / WrappedDataset

Class WrappedDataset

train.py:338–348  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

336
337
338class WrappedDataset(Dataset):
339 """Wraps an arbitrary object with __len__ and __getitem__ into a pytorch dataset"""
340
341 def __init__(self, dataset):
342 self.data = dataset
343
344 def __len__(self):
345 return len(self.data)
346
347 def __getitem__(self, idx):
348 return self.data[idx]
349
350
351def worker_init_fn(_):

Callers 1

setupMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected