Is the AttributeError thrown for sample['image'] or sample['grade']?
Are you able to get some sample before the original error is raised?
If so, could you add the print statement regarding the shape into __getitem__ directly before calling self.transform and post the output here?