Shortcuts

to_tensor

torchvision.transforms.functional.to_tensor(pic)torch.Tensor[source]

Convert a PIL Image or numpy.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

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources