'Torchscript call other function rather than forward
When I compile my torch model to torchscript I can make use of the function forward by just calling the torchscript model object model().
But when I want to use another function created on the model I cant call the function. I try to do model.functionName() expecting to call the function functionName but nothing happens.
Any idea on how could I call subfunctions from the model object that are not forward?
Thanks
Solution 1:[1]
I suppose you should add decorator @torch.jit.export above the method you want to call and convert torchscript model again. After that you can call method by module.run_method(name, args) docs.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
