What is the difference between "modules" and "functionals" in PyTorch?
In PyTorch, we have torch.nn.funtional and torch.nn, and the classes/functions within the former are typically referred to as &quot;functions&quot; while the latter as &quot;modules&quot;.
There seems to be a lot of overlap between the two, so I'm wondering what are each used for and what their differences are?

Here are the differences:

torch.nn.functional is the base functional interface (in terms of programming paradigm) to apply PyTorch operators on torch.Tensor.

torch.nn contains the wrapper nn.Module that provide a object-oriented interface to those operators.


So indeed there is a complete overlap, modules are a different way of accessing the operators provided by those functions.
Every single tensor operator in PyTorch is available in the form of a function and its wrapper class. For instance F.conv2d, F.relu, F.dropout, F.batch_norm etc... have corresponding modules nn.Conv2d, nn.ReLU, nn.Dropout, nn.BatchNorm2d, 2d, 3d.
