title: Pytorch DataLoader changes dict return values
body: <p>Given a Pytorch dataset that reads a JSON file as such:</p>
  <pre><code>import csv
  
  from torch.utils.data import IterableDataset
  from torch.utils.data import DataLoader2, DataLoader
  
  class MyDataset(IterableDataset):
      def __init__(self, jsonfilename):
          self.filename = jsonfilename
  
      def __iter__(self):
          with open(self.filename) as fin:
              reader = csv.reader(fin)
              headers = next(reader)
              for line in reader:
                  yield dict(zip(headers, line))
                  
  content = &quot;&quot;&quot;imagefile,label
  train/0/16585.png,0
  train/0/56789.png,0&quot;&quot;&quot;
  
  with open('myfile.json', 'w') as fout:
      fout.write(content)
  
  ds = MyDataset(&quot;myfile.json&quot;)
  </code></pre>
  <p>When I loop through the dataset, the return values are dict of each line of the json, e.g.</p>
  <pre><code>ds = MyDataset(&quot;myfile.json&quot;)
  
  for i in ds:
      print(i)
  </code></pre>
  <p>[out]:</p>
  <pre><code>{'imagefile': 'train/0/16585.png', 'label': '0'}
  {'imagefile': 'train/0/56789.png', 'label': '0'}
  </code></pre>
  <p>But when I read the Dataset into a <code>DataLoader</code>, it returns the values of the dict as lists instead of the values themselves, e.g.</p>
  <pre><code>ds = MyDataset(&quot;myfile.json&quot;)
  x = DataLoader(dataset=ds)
  
  for i in x:
      print(i)
  </code></pre>
  <p>[out]:</p>
  <pre><code>{'imagefile': ['train/0/16585.png'], 'label': ['0']}
  {'imagefile': ['train/0/56789.png'], 'label': ['0']}
  </code></pre>
  <h3>Q (part1) : Why does the DataLoader changes the value of the dict to a list?</h3>
  <p>and also</p>
  <h3>Q (part2) : How to make the DataLoader return just the values of the dict instead of the list of value when running <code>__iter__</code> with the DataLoader? Is there some arguments/options to use in DataLoader to do this?</h3>