I am not sure this is a pytorch question or a python question. In
line 127, why is it ok to call model(doc_indices, pivot_words, target_words) without specifying forward() method name?
I am not sure this is a pytorch question or a python question. In
line 127, why is it ok to call model(doc_indices, pivot_words, target_words) without specifying forward() method name?
python question.
When you call model(...), you are actually calling model.__call__(...). As you can see here, the __call__ method on nn.Module eventually calls forward along with taking care of tracing and hooks.
Would you mind explaining what do you by ‘tracing and hooks’ ?