pytorch
b6bb644e - Fix long line splitting issue in python_print (#37088)

Commit
4 years ago
Fix long line splitting issue in python_print (#37088) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/37088 For an inlined expression tree like `(e_0, (e_1, e_long))` the previous algoritm only scanned the same statement as `e_long`, splitting the inlined expressions across lines. Because it did not scan `e_0`, `e_0` would still get emitted inline, causing it to reverse order with `e_1` and `e_long`. The new algorithm scans starting at `e_long` and going all the way back up the expression until it reaches the end of the inlined statement. Caching of what has already been scanned has been added so that if there was a second long long `e_long2` after `e_long`, it would not rescan and re-inline the statements that were already split. Test Plan: Imported from OSS Differential Revision: D21180394 Pulled By: zdevito fbshipit-source-id: 4d142c83a04c89a47d04282f67a513f82cf153c0
Author
Parents
Loading