support non-persistent buffers (#1772)
Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/1772 X-link: https://github.com/pytorch/pytorch/pull/118722 Basic support for non-persistent buffers, which are buffers that do not show up in the state dict. One weird twist is that most of our other systems (FX, aot_export, dynamo) have completely buggy handling of non-persistent buffers. I tried to go on a wild goose chase to fix them all, but it got to be too much. So I introduced some sad rewrite passes in `_export` make the final state dict correctly align with the original module's state dict. This exposed some bugs/ambiguous handling of parameters/buffers in existing test code. For example, `TestSaveLoad.test_save_buffer` traced over a module that was not in the root module hierarchy and caused some weird behavior. I think we should error explicitly on use cases like this: https://github.com/pytorch/pytorch/issues/118410. For now I just rewrote the tests or skipped them. Reviewed By: SherlockNoMad, angelayi Differential Revision: D53253905 fbshipit-source-id: 62f91a40d74ca836154680fc6068deb873ecbf82
M
Michael Suo committed
3be5e12ed79394016718c1af992d4bf1288df35d
Parent: aff6f68
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 2/1/2024, 12:29:51 AM