New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FX] Fix python code having spurious newlines from placeholders #49720
Conversation
[ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit cca698a (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions to the (internal) Dr. CI Users group. This comment has been revised 3 times. |
ghstack-source-id: e398fc8d16129d85d928f4fd2c7259d34c3818a1 Pull Request resolved: #49720
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be refactored? The newline handling can just be:
emit_node(node)
delete_unused_values(node)
body.append('\n')
@zdevito that would still incorrectly append the newline after a |
@jamesr66a merged this pull request in 11598da. |
@jamesr66a merged this pull request in 11598da. |
The newline handling here is still pretty convoluted now -- there shouldn't need to be comment saying that some unrelated function is handling a newline for another function. Is it possible to refactor this so that newline handling for a statement occurs in one place? |
…rch#49720) Summary: Pull Request resolved: pytorch#49720 Test Plan: Imported from OSS Reviewed By: zdevito Differential Revision: D25675825 Pulled By: jamesr66a fbshipit-source-id: a9028acad9c8feb877fff5cd09aedabed52a3f4b
Stack from ghstack:
The logic in
Graph.python_code
didn't account forplaceholder
nodes withname == target
not emitting a line, so it was spuriously emitting one newline per placeholder in theGraph
. This patch fixes that.Test script:
Before
After
Differential Revision: D25675825