title: 'DataLoader' object does not support indexing
body: <p>I have downloaded the ImageNet dataset via this pytorch api by setting download=True. But I cannot iterate through the dataloader.</p>
  
  <p>The error says "'DataLoader' object does not support indexing"</p>
  
  <pre><code>trainset = torch.utils.data.DataLoader(
      datasets.ImageNet('/media/farshid/DataStore/temp/Imagenet/', split='train',
                        download=False))
  trainloader = torch.utils.data.DataLoader(trainset, batch_size=1, shuffle=False, num_workers=1)
  </code></pre>
  
  <p>I tried a simple approach I just tried to run the following,</p>
  
  <pre><code>trainloader[0]
  </code></pre>
  
  <p>In the root directory, the pattern is </p>
  
  <pre><code>root/  
      train/  
            n01440764/
            n01443537/ 
                     n01443537_2.jpg
  </code></pre>
  
  <p>The docs in the official website doesnt say anything else. <a href="https://pytorch.org/docs/stable/torchvision/datasets.html#imagenet" rel="nofollow noreferrer">https://pytorch.org/docs/stable/torchvision/datasets.html#imagenet</a>   </p>
  
  <p>What am I doing wrong ?</p>