torchvision.transforms.v2.functional.pil_to_tensor¶
- torchvision.transforms.v2.functional.pil_to_tensor(pic: Any) Tensor [source]¶
Convert a
PIL Image
to a tensor of the same type. This function does not support torchscript.See
PILToTensor
for more details.Note
A deep copy of the underlying array is performed.
- Parameters:
pic (PIL Image) – Image to be converted to tensor.
- Returns:
Converted image.
- Return type:
Tensor