MCPcopy Create free account
hub / github.com/OUCMachineLearning/OUCML / __getitem__

Method __getitem__

GAN/ACGAN-PyTorch-master/folder.py:120–135  ·  view source on GitHub ↗

Args: index (int): Index Returns: tuple: (image, target) where target is class_index of the target class.

(self, index)

Source from the content-addressed store, hash-verified

118 self.loader = loader
119
120 def __getitem__(self, index):
121 """
122 Args:
123 index (int): Index
124
125 Returns:
126 tuple: (image, target) where target is class_index of the target class.
127 """
128 path, target = self.imgs[index]
129 img = self.loader(path)
130 if self.transform is not None:
131 img = self.transform(img)
132 if self.target_transform is not None:
133 target = self.target_transform(target)
134
135 return img, target
136
137 def __len__(self):
138 return len(self.imgs)

Callers

nothing calls this directly

Calls 2

loaderMethod · 0.80
transformMethod · 0.80

Tested by

no test coverage detected