ViTFeatureExtractor PyTorch Batch problem
## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.15.0
- Platform: macOS
- Python version: 3.8
- PyTorch version (GPU?): CPU
- Tensorflow version (GPU?):
- Using GPU in script?: no
- Using distributed or parallel set-up in script?:

### Who can help

Models: ViTFeaturesExtractor

Model hub: google/vit-base-patch16-224-in21k

I'm trying to use this model with a Batch of images but every time I'm getting the error: "TypeError: Cannot handle this data type: (1, 1, 427, 320), |u1". If I do not use a Dataloader for the images It works well. If I not adding a dimension to the tensor it works well but when I use the batch size in the position 0 of a torch tensor it does not work. With some debugging inxpection I have found the fact that this string of code return False : `is_batched = bool(
            isinstance(images, (list, tuple))
            and (isinstance(images[0], (Image.Image, np.ndarray)) or is_torch_tensor(images[0]))
        )`

Bu If I'm using the is_torch_tensor method it give me that the images passed is a tensor of images but it is not.a list, I think that the check has to be changed like this: 
`is_batched = bool(
            (isinstance(images, (list, tuple))
            and (isinstance(images[0], (Image.Image, np.ndarray))) or is_torch_tensor(images[0]))
        )`

Whit this changes the model works.
Hi,

Currently the feature extractors only accept a list of individual PyTorch tensors/Numpy arrays/PIL images in case you want to preprocess a batch of images. One cannot provide a batch of images as a single PyTorch tensor to the feature extractor. 

However, there's a feature request to add this (see #14650).

Note that feature extractors use PIL to resize images, so it's most efficient to pass a list of PIL images.<|||||>Thank you for your answer but in this way I can't use the GPU for training a model that uses the ViT and is moved on the GPU because every time I give it a list of Cuda tensor it says it is not possible and It suggest me to use Tensor.cpu() at the same time if I send a CPU tensor and the complete model is on the GPU It gives me the error that I have to use the same type of tensor<|||||>Have you taken a look at the [notebooks](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/VisionTransformer) to fine-tune ViT?<|||||>I proposed a way to use DataLoader in #15055<|||||>This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.