(self, index)
return img, int(target)
Args:
            index (int): Index

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

        Returns:
            tuple: (image, target) where target is class_index of the target class.
        """
        # If loaded the entire dataset in RAM, get image from memory
        if self.load_in_mem:
            img = self.data[index]
            target = self.labels[index]

        # Else load it from disk
        else:
            with h5.File(self.root, 'r') as f:
                img = f['imgs'][index]
                target = f['labels'][index]

        # if self.transform is not None:
                # img = self.transform(img)
        # Apply my own transform
        img = ((torch.from_numpy(img).float() / 255) - 0.5) * 2

        if self.target_transform is not None:
            target = self.target_transform(target)

        return img, int(target)
def __getitem__ ( self , index ) : # If loaded the entire dataset in RAM, get image from memory if self . load_in_mem : img = self . data [ index ] target = self . labels [ index ] # Else load it from disk else : with h5 . File ( self . root , 'r' ) as f : img = f [ 'imgs' ] [ index ] target = f [ 'labels' ] [ index ] # if self.transform is not None: # img = self.transform(img) # Apply my own transform img = ( ( torch . from_numpy ( img ) . float ( ) / 255 ) - 0.5 ) * 2 if self . target_transform is not None : target = self . target_transform ( target ) return img , int ( target )