def __getitem__(self, index: int) -> Tuple[Any, Any]:
        """
        Args:
            index (int): Index
        Returns:
            tuple: (sample, target) where target is class_index of the target class.
        """
        curr_index = index
        for x in range(self.total):
            try:
                path, target = self.samples[curr_index]
                sample = self.loader(path)
                break
            except Exception as e:
                curr_index = np.random.randint(0, self.total)

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

        return sample, target

        Args:
            index (int): Index
        Returns:
            tuple: (sample, target) where target is class_index of the target class.
        
training/DeepSpeed-Domino/megatron/data/image_folder.py