MCPcopy Create free account
hub / github.com/LTH14/mar / __getitem__

Method __getitem__

util/loader.py:40–56  ·  view source on GitHub ↗

Args: index (int): Index Returns: tuple: (moments, target).

(self, index: int)

Source from the content-addressed store, hash-verified

38 )
39
40 def __getitem__(self, index: int):
41 """
42 Args:
43 index (int): Index
44
45 Returns:
46 tuple: (moments, target).
47 """
48 path, target = self.samples[index]
49
50 data = np.load(path)
51 if torch.rand(1) < 0.5: # randomly hflip
52 moments = data['moments']
53 else:
54 moments = data['moments_flip']
55
56 return moments, target

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected