Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
- The
Module.__call__
method register all hooks and call the methodModule.forward
. In short, when you train the model you should use the methodforward
, while when you test the model during training or when you do prediction using a well trained model, you should use the method__call__
.model.__call__(data)
is equivalent tomodel(data)
.
References
Why there are different output between model.forward(input) and model(input)
Is model.forward(x) the same as model.call(x)?