[fx_const_fold] Fix constant folding for attrs in submodule hierarchies (#64342)
authorJordan Fix <jfix@fb.com>
Wed, 8 Sep 2021 05:43:04 +0000 (22:43 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Wed, 8 Sep 2021 05:44:39 +0000 (22:44 -0700)
commit2341ec9ef10d7e168cc239396ebb6f3e74a5620d
tree28c211c6505485ad4e8178ca7d6e0ffe5ebee399
parent57212054179f1623833d46c852d2ac06b063326c
[fx_const_fold] Fix constant folding for attrs in submodule hierarchies (#64342)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/64342

Previously we weren't handling the case where an attribute was in a module that wasn't the root.

Test Plan: Added unit test coverage.

Reviewed By: yinghai

Differential Revision: D30691730

fbshipit-source-id: b39b5cf748c4c882f315a4f32b51ad88cc7a43ed
test/fx/test_fx_const_fold.py
torch/fx/experimental/const_fold.py