Should one use `forward` to predict with a model?

I was told that mdl.forward(x) is not the same as mdl(x). What is the difference? What type of bug results from using one versus the other? Is there really a bug here?

Here’s the code for Module.call (the method that gets called when you do mdl(x)). It calls forward hooks and sets up the backwards hook for when backward is called. If you use mdl.forward(x) instead of mdl(x), then from what I understand of this code snippet you probably won’t be able to backpropagate.

1 Like