Solved by driazati in post #2 
              
              
                The two don’t necessarily produce the same IR (which is what you’re seeing, it corresponds directly to module.graph) since tracing only records tensor operations as they occur, while scripting will compile the code itself. Tracing will unroll loops based on your example input, so this is probably wh…