Commit 11f73d7
[export] Downgrade captured buffers as normal constants. (pytorch#166777)
Summary:
make_fx() will register tensor constants as new buffers while tracing a shuffle graph for dynamo graph capture. This breaks the invariance that the resulting graph looks identical to the original eager model in terms of state dict.
So we need to de-register the buffers and set them as plain tensor constants.
Test Plan:
pytest test/export/test_experimental.py
Pull Request resolved: pytorch#166777
Approved by: https://github.com/tugsbayasgalan
ghstack dependencies: pytorch#166775, pytorch#1667761 parent 7d1b976 commit 11f73d7
File tree
2 files changed
+30
-4
lines changed- test/export
- torch/_dynamo
2 files changed
+30
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
579 | 579 | | |
580 | 580 | | |
581 | 581 | | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
582 | 602 | | |
583 | 603 | | |
584 | 604 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
453 | 461 | | |
454 | 462 | | |
455 | 463 | | |
| |||
526 | 534 | | |
527 | 535 | | |
528 | 536 | | |
529 | | - | |
530 | | - | |
| 537 | + | |
531 | 538 | | |
532 | 539 | | |
533 | 540 | | |
| |||
575 | 582 | | |
576 | 583 | | |
577 | 584 | | |
578 | | - | |
579 | | - | |
| 585 | + | |
580 | 586 | | |
581 | 587 | | |
582 | 588 | | |
| |||
0 commit comments