to_tensor¶
- torchvision.transforms.functional.to_tensor(pic: Union[Image, ndarray]) Tensor [source]¶
Convert a
PIL Image
ornumpy.ndarray
to tensor. This function does not support torchscript.See
ToTensor
for more details.- Parameters:
pic (PIL Image or numpy.ndarray) – Image to be converted to tensor.
- Returns:
Converted image.
- Return type:
Tensor