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

Method __getitem__

utils/data.py:23–27  ·  view source on GitHub ↗
(self, idx)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected