Where is the nn.functional.to_tensor()?

when I read the source code of torchvision.transforms.transforms(http://pytorch.org/docs/0.3.0/_modules/torchvision/transforms/transforms.html#Resize) I found the class ToTensor use a method i.e. F.to_tensor(pic), but I can not find the method in torch.nn.functional,which do I miss?

1 Like

Look at the namespace. That functional is under torchvision namespace. It’s different with the one under torch.

1 Like

@SimonW is right. I miss ths namespace first time. and I search the torchvision.transform and find in torchvison.transform’s Docs
Transforms are common image transformations. They can be chained together using Compose. Additionally, there is the torchvision.transforms.functional module. Functional transforms give fine-grained control over the transformations.

details in
https://pytorch.org/docs/stable/torchvision/transforms.html#torchvision.transforms.functional.to_tensor