Commit 672c3fb
committed
TST: ndimage: avoid implicit dtype conversions in vectorized_filter tests
This tests does this: `vectorized_filter(input, xp.sum, output)`, with output
being `xp.empty_like(input)`. This is problematic for short integers because
- the output of xp.sum(int8_array) is int64 (the default int dtype), and
- internally, vectorized_filter does roughly,
`output[some_indices] = xp.sum(input[some_indices])`
So what happens here is that the output of the `sum` in the r.h.s. gets silently
downcast to the dtype of the l.h.s. by `__setitem__`.
This kind of sort of works in many array libraries, but is technically unspecified
by the Array API standard. And indeed this starts failing with array-api-strict
in data-apis/array-api-strict#157
Thus, a test only change to make downcasting explicit.1 parent a465e2c commit 672c3fb
1 file changed
+8
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2864 | 2864 | | |
2865 | 2865 | | |
2866 | 2866 | | |
2867 | | - | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
2868 | 2875 | | |
2869 | 2876 | | |
2870 | 2877 | | |
| |||
0 commit comments