MCPcopy Create free account
hub / github.com/NineAbyss/ZeroG / __init__

Method __init__

code/utils.py:300–312  ·  view source on GitHub ↗
(self, original_dataset)

Source from the content-addressed store, hash-verified

298
299class OneShotDataset(Dataset):
300 def __init__(self, original_dataset):
301 self.data = []
302 self.labels = []
303 class_samples = {}
304
305 for i in range(len(original_dataset)):
306 data = original_dataset.data.x[i]
307 label = original_dataset.data.y[i].item()
308 if label not in class_samples:
309 class_samples[label] = data
310 self.labels.append(label)
311
312 self.data = list(class_samples.values())
313
314 def __len__(self):
315 return len(self.data)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected