Commit 4c0cce3
authored
* Preserve float64 precision in convolve_2d (#1096)
All four backends hardcoded .astype(float32), silently truncating
float64 input. Now integer inputs are promoted to float32 (avoiding
overflow) while float64 inputs keep their precision. Output dtype
matches the promoted input.
* Add float64 preservation tests for convolve_2d (#1096)
- test_convolve_2d_preserves_float64_1096: float64 input at 1e7
magnitude retains precision across all 4 backends
- test_convolve_2d_int_promotes_to_float32_1096: int32 input gets
promoted to float, not left as integer
1 parent aa74fbb commit 4c0cce3
2 files changed
+71
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
20 | 27 | | |
21 | 28 | | |
22 | 29 | | |
| |||
286 | 293 | | |
287 | 294 | | |
288 | 295 | | |
289 | | - | |
290 | | - | |
| 296 | + | |
291 | 297 | | |
292 | 298 | | |
293 | 299 | | |
294 | 300 | | |
295 | 301 | | |
296 | 302 | | |
297 | 303 | | |
298 | | - | |
| 304 | + | |
299 | 305 | | |
300 | 306 | | |
301 | 307 | | |
| |||
315 | 321 | | |
316 | 322 | | |
317 | 323 | | |
| 324 | + | |
318 | 325 | | |
319 | 326 | | |
320 | 327 | | |
| |||
329 | 336 | | |
330 | 337 | | |
331 | 338 | | |
332 | | - | |
| 339 | + | |
333 | 340 | | |
334 | 341 | | |
335 | 342 | | |
| |||
393 | 400 | | |
394 | 401 | | |
395 | 402 | | |
396 | | - | |
397 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
398 | 406 | | |
399 | 407 | | |
400 | 408 | | |
401 | 409 | | |
402 | 410 | | |
403 | 411 | | |
404 | 412 | | |
405 | | - | |
| 413 | + | |
406 | 414 | | |
407 | 415 | | |
408 | 416 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
942 | 942 | | |
943 | 943 | | |
944 | 944 | | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
945 | 1001 | | |
946 | 1002 | | |
947 | 1003 | | |
| |||
0 commit comments