Commit fe007e4
[ts_converter] Fix prim::If buffer names (#136648)
Summary:
We previously incorrectly handled the following graph, specifically for the node `w.3` in `block0`:
```
graph(%x.1 : Float(3, strides=[1], requires_grad=0, device=cpu),
%y.1 : int):
%2 : __torch__.___torch_mangle_1.M = prim::CreateObject()
%3 : int = prim::Constant[value=20](), scope: M:: # /data/users/angelayi/pytorch/test/export/test_converter.py:747:34
%4 : int = prim::Constant[value=10](), scope: M:: # /data/users/angelayi/pytorch/test/export/test_converter.py:746:34
%5 : int = prim::Constant[value=1](), scope: M::
%w.1 : int = prim::GetAttr[name="w"](%2), scope: M::
%7 : int = aten::mul(%w.1, %4), scope: M:: # /data/users/angelayi/pytorch/test/export/test_converter.py:746:25
= prim::SetAttr[name="w"](%2, %7), scope: M::
%h.1 : int = prim::GetAttr[name="h"](%2), scope: M::
%9 : int = aten::mul(%h.1, %3), scope: M:: # /data/users/angelayi/pytorch/test/export/test_converter.py:747:25
= prim::SetAttr[name="h"](%2, %9), scope: M::
%10 : bool = aten::gt(%y.1, %4), scope: M:: # /data/users/angelayi/pytorch/test/export/test_converter.py:749:19
%res.37 : Tensor = prim::If(%10), scope: M:: # /data/users/angelayi/pytorch/test/export/test_converter.py:749:16
block0():
%w.3 : int = prim::GetAttr[name="w"](%2), scope: M::
%res.1 : Tensor = aten::add(%x.1, %w.3, %5), scope: M:: # <string>:5:9
-> (%res.1)
block1():
%h.3 : int = prim::GetAttr[name="h"](%2), scope: M::
%res.3 : Tensor = aten::add(%x.1, %h.3, %5), scope: M:: # <string>:5:9
-> (%res.3)
%16 : bool = aten::lt(%y.1, %4), scope: M:: # /data/users/angelayi/pytorch/test/export/test_converter.py:754:19
%res : Tensor = prim::If(%16), scope: M:: # /data/users/angelayi/pytorch/test/export/test_converter.py:754:16
block0():
%w : int = prim::GetAttr[name="w"](%2), scope: M::
%res.15 : Tensor = aten::add(%res.37, %w, %5), scope: M:: # <string>:5:9
-> (%res.15)
block1():
%h : int = prim::GetAttr[name="h"](%2), scope: M::
%res.21 : Tensor = aten::add(%res.37, %h, %5), scope: M:: # <string>:5:9
-> (%res.21)
return (%res)
```
Test Plan: CI
Differential Revision: D63399064
Pull Request resolved: #136648
Approved by: https://github.com/SherlockNoMad1 parent b18a850 commit fe007e4
2 files changed
+54
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
838 | 838 | | |
839 | 839 | | |
840 | 840 | | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
841 | 867 | | |
842 | 868 | | |
843 | 869 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
264 | 266 | | |
265 | 267 | | |
266 | 268 | | |
| |||
272 | 274 | | |
273 | 275 | | |
274 | 276 | | |
275 | | - | |
| 277 | + | |
| 278 | + | |
276 | 279 | | |
277 | 280 | | |
278 | 281 | | |
| |||
334 | 337 | | |
335 | 338 | | |
336 | 339 | | |
337 | | - | |
| 340 | + | |
338 | 341 | | |
339 | 342 | | |
340 | 343 | | |
| |||
393 | 396 | | |
394 | 397 | | |
395 | 398 | | |
| 399 | + | |
396 | 400 | | |
397 | 401 | | |
| 402 | + | |
398 | 403 | | |
| 404 | + | |
399 | 405 | | |
400 | 406 | | |
401 | 407 | | |
402 | 408 | | |
403 | 409 | | |
404 | 410 | | |
| 411 | + | |
405 | 412 | | |
406 | 413 | | |
407 | 414 | | |
| 415 | + | |
| 416 | + | |
408 | 417 | | |
409 | 418 | | |
410 | 419 | | |
411 | | - | |
| 420 | + | |
412 | 421 | | |
413 | 422 | | |
414 | 423 | | |
| |||
427 | 436 | | |
428 | 437 | | |
429 | 438 | | |
| 439 | + | |
| 440 | + | |
430 | 441 | | |
431 | 442 | | |
432 | 443 | | |
| |||
467 | 478 | | |
468 | 479 | | |
469 | 480 | | |
| 481 | + | |
470 | 482 | | |
471 | | - | |
472 | 483 | | |
473 | 484 | | |
474 | 485 | | |
| |||
537 | 548 | | |
538 | 549 | | |
539 | 550 | | |
| 551 | + | |
| 552 | + | |
540 | 553 | | |
541 | 554 | | |
542 | 555 | | |
| |||
1325 | 1338 | | |
1326 | 1339 | | |
1327 | 1340 | | |
| 1341 | + | |
1328 | 1342 | | |
1329 | 1343 | | |
1330 | 1344 | | |
| |||
1333 | 1347 | | |
1334 | 1348 | | |
1335 | 1349 | | |
| 1350 | + | |
1336 | 1351 | | |
1337 | 1352 | | |
1338 | 1353 | | |
| |||
1427 | 1442 | | |
1428 | 1443 | | |
1429 | 1444 | | |
1430 | | - | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
1431 | 1448 | | |
1432 | 1449 | | |
1433 | 1450 | | |
| |||
1436 | 1453 | | |
1437 | 1454 | | |
1438 | 1455 | | |
| 1456 | + | |
1439 | 1457 | | |
1440 | 1458 | | |
1441 | 1459 | | |
| |||
1464 | 1482 | | |
1465 | 1483 | | |
1466 | 1484 | | |
1467 | | - | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
1468 | 1488 | | |
1469 | 1489 | | |
1470 | 1490 | | |
| |||
1473 | 1493 | | |
1474 | 1494 | | |
1475 | 1495 | | |
| 1496 | + | |
1476 | 1497 | | |
1477 | 1498 | | |
1478 | 1499 | | |
| |||
0 commit comments