Let’s say I defined the a model class. Now I want to implement a train function inside the class for which i need to call the model. How should i do that.
Which one is the right way to do this :
model.__call__(input) are the same.
It is the python convention to have the
__call__ method being called when you use
In this case, you can do
self(x) if that works but I’m not sure it does).
@shagunsodhani No this is not the right way !! You should not call
.forward() directly ! If you do this, many of the
nn.Module functionality won’t work (hooks for example).
@albanD you are right. I confused it with something else