Commit 0225d67
authored
[Relax][PyTorch] Fix MultiheadAttention complie (#18459)
## Related Issus
closes #18440
## Why
- PyTorch `masked_fill` / `full_like` accept inf or nan and TVM couldn’t
handle these values when the tensor dtype was not float, which caused
wrong behavior or errors.
## How
- If `fill_value` is inf or nan and the tensor dtype is not float →
convert the fill to float32.
- For masked_fill → Create a float values tensor with full_like.
- Cast input to float if needed.
- In TOPI → Reject creating full with inf/nan on non-float dtypes.1 parent a9955e5 commit 0225d67
File tree
2 files changed
+47
-5
lines changed- python/tvm
- relax/frontend/torch
- topi
2 files changed
+47
-5
lines changedLines changed: 38 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2085 | 2085 | | |
2086 | 2086 | | |
2087 | 2087 | | |
2088 | | - | |
2089 | | - | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
2090 | 2098 | | |
2091 | 2099 | | |
2092 | 2100 | | |
| |||
2099 | 2107 | | |
2100 | 2108 | | |
2101 | 2109 | | |
2102 | | - | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
2103 | 2123 | | |
2104 | 2124 | | |
2105 | 2125 | | |
| |||
2130 | 2150 | | |
2131 | 2151 | | |
2132 | 2152 | | |
2133 | | - | |
2134 | | - | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
2135 | 2168 | | |
2136 | 2169 | | |
2137 | 2170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
60 | 69 | | |
61 | 70 | | |
62 | 71 | | |
| |||
0 commit comments