Solved by tom in post #2 
              
              
                Last I looked, CPU fusion was disabled by default, so you need to enable it with 
torch._C._jit_override_can_fuse_on_cpu(True). 
Printing myfn.graph_for(inp) will show if you have fusion for your inputs. 
Note that as optimized graphs are cached, you need to re-define the traced/scripted function in…