Commit ae499a4
committed
Do not recreate Scalar Ops with custom TransferType for Elemwise inplacing
This helper could arbitrarily override the default output_type from `ScalarOp.make_node` so that the output type matched one of the input types.
This can be used to create artificial Op signatures that don't make sense or can't be cleanly implemented in other backends. For instance an Add with signature (int8,int64)->int8.
This helper was historically used in:
1. Elemwise inplace rewrite. I assume as a preventive measure. However, regular use should never require changing the ScalarOp signature, as we only try to inplace on inputs that match the output dtype and recreating the same Op with the same input types should always return the same output type. ScalarOp don't have a concept of inplace, only the Elemwise wrapper does, and it shouldn't require recreating/mutating the original Op.
2. SecondOp. Here it makes sense, but a custom static_method works just as well
3. Inplace tests with the inplace variants of `@scalar_elemwise` decorator. These test Classes were removed. It still didn't make sense to test/force Ops to have an artifical signature for the sake of tests. They were removed anyway1 parent e0a2a86 commit ae499a4
File tree
5 files changed
+40
-73
lines changed- pytensor
- scalar
- tensor/rewriting
- tests/tensor
5 files changed
+40
-73
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1101 | 1101 | | |
1102 | 1102 | | |
1103 | 1103 | | |
1104 | | - | |
1105 | | - | |
1106 | | - | |
1107 | | - | |
1108 | | - | |
1109 | | - | |
1110 | | - | |
1111 | | - | |
1112 | | - | |
1113 | | - | |
1114 | | - | |
1115 | | - | |
1116 | | - | |
1117 | | - | |
1118 | | - | |
1119 | | - | |
1120 | | - | |
1121 | | - | |
1122 | | - | |
1123 | | - | |
1124 | | - | |
1125 | | - | |
1126 | | - | |
1127 | | - | |
1128 | 1104 | | |
1129 | 1105 | | |
1130 | 1106 | | |
| |||
2446 | 2422 | | |
2447 | 2423 | | |
2448 | 2424 | | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
2449 | 2429 | | |
2450 | 2430 | | |
2451 | 2431 | | |
| |||
2474 | 2454 | | |
2475 | 2455 | | |
2476 | 2456 | | |
2477 | | - | |
| 2457 | + | |
2478 | 2458 | | |
2479 | 2459 | | |
2480 | 2460 | | |
| |||
2515 | 2495 | | |
2516 | 2496 | | |
2517 | 2497 | | |
2518 | | - | |
2519 | | - | |
2520 | | - | |
2521 | | - | |
2522 | | - | |
2523 | | - | |
2524 | | - | |
2525 | | - | |
2526 | | - | |
2527 | | - | |
2528 | | - | |
2529 | | - | |
2530 | 2498 | | |
2531 | 2499 | | |
2532 | 2500 | | |
| |||
4322 | 4290 | | |
4323 | 4291 | | |
4324 | 4292 | | |
4325 | | - | |
4326 | | - | |
4327 | | - | |
4328 | | - | |
4329 | | - | |
4330 | | - | |
4331 | | - | |
4332 | | - | |
4333 | | - | |
4334 | | - | |
4335 | | - | |
4336 | | - | |
4337 | | - | |
4338 | | - | |
4339 | | - | |
4340 | | - | |
4341 | 4293 | | |
4342 | 4294 | | |
4343 | 4295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | 139 | | |
143 | 140 | | |
144 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| |||
287 | 286 | | |
288 | 287 | | |
289 | 288 | | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
297 | 297 | | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
| 298 | + | |
| 299 | + | |
306 | 300 | | |
307 | 301 | | |
308 | 302 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2797 | 2797 | | |
2798 | 2798 | | |
2799 | 2799 | | |
2800 | | - | |
2801 | 2800 | | |
2802 | 2801 | | |
2803 | 2802 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1200 | 1200 | | |
1201 | 1201 | | |
1202 | 1202 | | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
0 commit comments