If you read the source code of ImageFolder carefully, you will know that train_loader will generate a batch of image and the corresponding labels. So x_  will be a list(or tuple? I am quite sure). You should use something like
for data, target in train_loader:
     # do something with data and target, which are both Tensor
    # data and target will have a method called size()