Torch.nn.functional.xxx vs. torch.xxx

What is the current and future best practice regarding the use of torch.nn.functional.XXX or torch.XXX?

For instance I see that torch.conv{1,2,3}d exist, but only torch.avg_pool1d … Should these functions be already used instead of their torch.nn.functional equivalent? If yes where are the missing average pooling?

If you check source code functionals come from torch.xxx

Altough im not dev, i guess functionals have several benefits for autograd etcetera… therefore I would recommend you to use nn functionals

You use the documented interfaces. They are good for you.
You can use the non-documented interfaces, they will break for you and you get to keep the pieces.
The functions will be mostly identical in function at the moment.

So the back story is:

  • ATen native (i.e. non-TH… legacy) doesn’t know about namespaces at this point,
  • this causes, at the moment, all “public” ATen functions to show up as torch.XXX,
  • because there also is a C++ interface, you cannot rename everything with “_” as one might think of doing,
  • so things showing up in torch.XXX when they’re documented to live in torch.nn.XXX accidental and a small bug likely to be fixed at some point of time.

Best regards

Thomas