MCPcopy Create free account
hub / github.com/CausalLearning/robust-unlearnable-examples / IndexedTensorDataset

Class IndexedTensorDataset

utils/data.py:18–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16
17
18class IndexedTensorDataset():
19 def __init__(self, x, y):
20 self.x = x
21 self.y = y
22
23 def __getitem__(self, idx):
24 x, y = self.x[idx], self.y[idx]
25 ''' transform HWC pic to CWH pic '''
26 x = torch.tensor(x, dtype=torch.float32).permute(2,0,1)
27 return x, y, idx
28
29 def __len__(self):
30 return len(self.x)
31
32
33class Dataset():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected