Yeah, jit.trace is of limited use. It can process some python code without requiring modifications (type annotations, etc.), but at the same time non-trivial code may fail to work correctly, if any non-tensor non-constants get captured.



 Flicic_Suo:

Also I cannot understand why the toturial calls somthing like jit.trace(jit.script(module)) then. Does this make any sense?


No, this doesn’t make sense. Note that jit.script(module) returns a new module, old one remains in uncompiled state.