pytorch
44622bbd - [jit] Add lazy script decorator (#34935)

Commit
4 years ago
[jit] Add lazy script decorator (#34935) Summary: Stacked PRs * #34938 - [jit] Remove stray `script` * **#34935 - [jit] Add lazy script decorator** Some users maintain libraries of code that is largely trace-able but not script-able. However, some functions may need to be `torch.jit.script`ed if they contain control flow so the tracer will use the compiler version. This however impacts library start up time as in #33418, so this PR adds a workaround in the form of a `torch.jit._lazy_script_while_tracing` that will only initialize the compiler if the function is called while actually tracing. Pull Request resolved: https://github.com/pytorch/pytorch/pull/34935 Pulled By: driazati Differential Revision: D20569778 fbshipit-source-id: d87c88c02b1abc86b283729ab8db94285d7d4853
Author
davidriazati
Parents
Loading