pytorch
53e05ad4 - ns for fx: remove restriction on nodes with no args and only kwargs

Commit
2 years ago
ns for fx: remove restriction on nodes with no args and only kwargs Summary: Removes the restriction from NS for FX on handling nodes which have no positional arguments, such as `F.linear(input=x, weight=w, bias=b). In order to achieve this, we delete all places in the code which were doing things like ``` node.args[0] ``` And replace them with ``` _get_normalized_nth_input(node, gm, 0) ``` The `_get_normalized_nth_input` function is a best effort way to get the n'th normalized input. This is needed because some FX tools output nodes normalized to be kwargs only, and we need to be able to handle this in NS. Test plan: ``` python test/test_quantization.py -k test_linear_kwargs_shadow ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/78181 Approved by: https://github.com/z-a-f, https://github.com/hx89
Author
Committer
Parents
Loading