I went through the official doc of TorchScript (https://pytorch.org/docs/stable/jit.html) but didn’t understand clearly what is the advantage of Tracing over Scripting.
Af far as I understood, both
jit.trace can convert existing
nn.Module instances into TorchScript. However Tracing cannot handle control flow such as if/for and it also requires an example input. The inability to handle control flow sounds like a huge deal breaker.
The only disadvantage of Scripting I noticed is that it cannot handle several builtin modules like RNN/GRU.
Are there any reasons to use Tracing over Scripting?
BTW, can LSTM be scripted? It is a little odd that RNN and GRU cannot be scripted but LSTM can.