Commit 549e940
authored
Add device-aware output dtype for
This PR proposes device-aware output dtype resolution for
`dpnp.tensor.round()` with `boolean` input to handle devices that do not
support `float16`
Boolean support for round() was originally added in #2817
[6f5a792](6f5a792)
to match NumPy behavior where numpy.round(bool) returns float16 rather
than an integral type like int8.
However on devices without fp16 support, returning float16 is not
viable.
The bool type mapping was removed from the round kernel and an
acceptance
function `_acceptance_fn_round` was added to ensure the fallback in
`_find_buf_dtype`
prefers floating-point output over integral types for boolean input
Result :
fp16 devices: round(bool) -> float16
non-fp16 devices: round(bool) -> float32dpt.round() with boolean input (#2851)1 parent 4b163bf commit 549e940
File tree
3 files changed
+14
-2
lines changed- dpnp/tensor
- libtensor/include/kernels/elementwise_functions
3 files changed
+14
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
1723 | 1724 | | |
1724 | 1725 | | |
1725 | 1726 | | |
1726 | | - | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
1727 | 1732 | | |
1728 | 1733 | | |
1729 | 1734 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
136 | 143 | | |
137 | 144 | | |
138 | 145 | | |
| |||
970 | 977 | | |
971 | 978 | | |
972 | 979 | | |
| 980 | + | |
973 | 981 | | |
974 | 982 | | |
975 | 983 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | 119 | | |
121 | 120 | | |
122 | 121 | | |
| |||
0 commit comments