The __getitem__ method is usually used to load a single sample using the passed index.
So your code snippet would profile the loading time of a single sample, while the ImageNet example would profile the complete DataLoader, i.e. the time could approach zero if the workers are preloading the next batches fast enough while your GPU is busy.