Can ScriptModule be used for training?

Can ScriptModule be used for training? The reason we ask this question is that we found some source code related back propagation in torch.jit. https://github.com/pytorch/pytorch/blob/master/torch/csrc/jit/autodiff.cpp#L1151

1 Like

I am having the same question, did you find an answer?

Edit:

I coudn’t find any example or explicit statement in the documentation. Here, it is stated that

TorchScript is a way to create serializable and optimizable models from PyTorch code

but I think in this context optimizable refers to the just-in-time compilation.

The question could also be rephrased to: Is there an alternative to the function parameters() in torch::jit::script::Module, which enables the use of optimizers?

Edit2:

I opened in issue on github, regarding the documentation for this use case: https://github.com/pytorch/pytorch/issues/17614