Hello to everyone,
I’m a newcomer to the Pytorch realm. I am faced with a question like this:
Is it necessary to define the sub-layers that we will use within the main Net module as a class outside the module, or can it be defined as a function?
Herein: https://github.com/FrancescoSaverioZuppichini/Pytorch-how-and-when-to-use-Module-Sequential-ModuleList-and-ModuleDict/blob/master/notebook.ipynb, it’s defined as function, but in https://github.com/pytorch/vision/blob/master/torchvision/models/googlenet.py, inception is created by using class…
Ex: conv - BN - ReLU
def myConv(x):
x = conv2d(x)
x = bnorm(x)
return ReLU(x)
or
class myConv(nn.Module) …
and also what is the difference?
Thanks…