Commit 32f4339
refactor: simplify forward() permutation logic for compile-friendly execution
What's changed
- Replace tensor-based perm construction with list-based version
- Add explicit inverse permutation for correctness
- Remove TorchScript-specific branches
Why
- Compile-friendly: torch.compile/AOTAutograd prefer static Python control flow and index lists over device tensor construction inside forward. Replacing torch.tensor([...]), torch.arange(...), and torch.cat(...) with plain Python lists reduces graph breaks and guard complexity, improving compilation stability and cache reuse.1 parent ff16d32 commit 32f4339
1 file changed
+8
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
492 | 483 | | |
493 | 484 | | |
494 | 485 | | |
495 | 486 | | |
496 | 487 | | |
497 | 488 | | |
498 | | - | |
499 | 489 | | |
500 | 490 | | |
501 | 491 | | |
| |||
510 | 500 | | |
511 | 501 | | |
512 | 502 | | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
| 503 | + | |
| 504 | + | |
518 | 505 | | |
519 | 506 | | |
520 | 507 | | |
| |||
0 commit comments