Commit a99e8ee
Propagate real tensor tracing with torchbind + fixing side effects (pytorch#138797)
Summary:
* Fixed real tensor tracing w/ torchbind objs by passing the cloned tensor obj. For now I just catch the exception and have an error message if the `_clone` fails, but up for discussion on what to do here
* Separate question, should we require people to set up FakeScriptObjects and stuff for draft mode?
* Prevent side effects from happening when we do the first pass of custom ops profiling by cloning/copying everything. Not sure if deepcopying the model will succeed in all cases... But also I guess this path can be removed once custom ops profiling turns into one pass.
Test Plan: `buck2 run @//mode/dev-nosan //scripts/angelayi/draft_export:test_draft_export`
Reviewed By: ydwu4
Differential Revision: D64124825
Pull Request resolved: pytorch#138797
Approved by: https://github.com/ydwu41 parent dd9ff9f commit a99e8ee
File tree
2 files changed
+20
-2
lines changed- torch
- _library
- _subclasses
2 files changed
+20
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
19 | 32 | | |
20 | 33 | | |
21 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
1947 | 1948 | | |
1948 | 1949 | | |
1949 | 1950 | | |
1950 | | - | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
1951 | 1954 | | |
1952 | 1955 | | |
1953 | 1956 | | |
| |||
1957 | 1960 | | |
1958 | 1961 | | |
1959 | 1962 | | |
| 1963 | + | |
| 1964 | + | |
1960 | 1965 | | |
1961 | 1966 | | |
1962 | 1967 | | |
| |||
0 commit comments