torchrec
torchrec copied to clipboard
Refactor source code parity check with `ast`
Use ast.unparse(ast.parse(code)) to normalize the source code. This ignores formatting differences and allows us to enable code formattor on torch upstream.
As per:
- https://github.com/pytorch/pytorch/pull/128594#issuecomment-2181558483
- https://github.com/pytorch/pytorch/pull/128594#discussion_r1649795743