Commit 4d67708
committed
Fix
`dpnp.linspace` returned `NaN` instead of the endpoint value when
`start` and `stop` are equal and infinite — e.g. `dpnp.linspace(inf,
inf, 4)` gave `[nan inf inf nan]`.
The bug had two independent sources:
- The array path in `dpnp_linspace` computed `delta = stop - start`, so
`inf - inf = NaN` propagated through the whole result.
- The scalar path delegates to `dpnp.tensor.linspace`, whose affine
kernel `LinearSequenceAffineFunctor` evaluates `start * w + stop * wc`;
at the endpoints one weight is `0`, and `inf * 0 = NaN`.
The PR proposes to fix all the places.
Note, the tests compare against NumPy on versions that include the fix
(NumPy >= 2.6.0) and fall back to explicit expected values on older
NumPy. 94dcfefdpnp.linspace returning NaN for equal infinite endpoints (#3043)1 parent 3c9213a commit 4d67708
5 files changed
Lines changed: 14 additions & 14 deletions
File tree
- _modules/dpnp
- backend_doc
- reference
- generated
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3984 | 3984 | | |
3985 | 3985 | | |
3986 | 3986 | | |
3987 | | - | |
| 3987 | + | |
3988 | 3988 | | |
3989 | 3989 | | |
3990 | 3990 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
| |||
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
| 54 | + | |
| 55 | + | |
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
53 | 59 | | |
54 | 60 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | 61 | | |
64 | 62 | | |
65 | 63 | | |
| |||
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
| 80 | + | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1055 | 1055 | | |
1056 | 1056 | | |
1057 | 1057 | | |
1058 | | - | |
| 1058 | + | |
1059 | 1059 | | |
1060 | 1060 | | |
1061 | 1061 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1108 | 1108 | | |
1109 | 1109 | | |
1110 | 1110 | | |
1111 | | - | |
| 1111 | + | |
1112 | 1112 | | |
1113 | 1113 | | |
1114 | 1114 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments