title: PyTorch DataLoader returning list instead of tensor on custom Dataset
body: <p>I do a trial about my dataset, this is my complete code:</p>
  <pre><code>data_root='D:/AuxiliaryDocuments/NYU/'
  raw_data_transforms=transforms.Compose([#transforms.ToPILImage(),
                             transforms.CenterCrop((224,101)),
                             transforms.ToTensor()])
  depth_data_transforms=transforms.Compose([transforms.CenterCrop((74,55)),
                                        transforms.ToTensor()])
  
  filename_txt={'image_train':'image_train.txt','image_test':'image_test.txt',
            'depth_train':'depth_train.txt','depth_test':'depth_test.txt'}
  
  
  class Mydataset(Dataset):
    def __init__(self,data_root,transformation,data_type):
       self.transform=transformation
       self.image_path_txt=filename_txt[data_type]
       self.sample_list=list()
       f=open(data_root+'/'+data_type+'/'+self.image_path_txt)
       lines=f.readlines()
       for line in lines:
          line=line.strip()
          line=line.replace(';','')
          self.sample_list.append(line)
       f.close()
  
    def __getitem__(self, index):
       item=self.sample_list[index]
       img=Image.open(item)
       if self.transform is not None:
          img=self.transform(img)
       idx=index
       print(type(img))
      return idx,img
  
   def __len__(self):
      return len(self.sample_list)
  </code></pre>
  <p>I print the type of img that is <strong>&lt;class 'torch.Tensor'&gt;</strong>, then I used the  coding below：</p>
  <pre><code>test=Mydataset(data_root,raw_data_transforms,'image_train')
  test_1=Mydataset(data_root,depth_data_transforms,'depth_train')
  test2=DataLoader(test,batch_size=4,num_workers=0,shuffle=False)
  test_2=DataLoader(test_1,batch_size=4,num_workers=0,shuffle=False)
  </code></pre>
  <p>print the information:</p>
  <pre><code>for idx,data in enumerate(test_2):
     print(idx,data)
     print(type(data))
  </code></pre>
  <p>but the type of data is <strong>'&lt;class 'list'&gt;'</strong>, which I need is tensor.</p>