Skip to content

Commit

Permalink
Throw ValueError when types cannot be resolved
Browse files Browse the repository at this point in the history
Previously, elementwise functions and clip would throw a TypeError in this case
  • Loading branch information
ndgrigorian committed Oct 24, 2023
1 parent f856624 commit 4366943
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dpctl/tensor/_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def _clip_none(x, val, out, order, _binary_fn):
_fp16 = sycl_dev.has_aspect_fp16
_fp64 = sycl_dev.has_aspect_fp64
if not _can_cast(val_dtype, res_dt, _fp16, _fp64):
raise TypeError(
raise ValueError(
f"function 'clip' does not support input types "
f"({x_dtype}, {val_dtype}), "
"and the inputs could not be safely coerced to any "
Expand Down Expand Up @@ -527,7 +527,7 @@ def clip(x, min=None, max=None, out=None, order="K"):
)

if res_dt is None:
raise TypeError(
raise ValueError(
f"function '{clip}' does not support input types "
f"({x_dtype}, {min_dtype}, {max_dtype}), "
"and the inputs could not be safely coerced to any "
Expand Down
2 changes: 1 addition & 1 deletion dpctl/tensor/_elementwise_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def __call__(self, o1, o2, out=None, order="K"):
)

if res_dt is None:
raise TypeError(
raise ValueError(
f"function '{self.name_}' does not support input types "
f"({o1_dtype}, {o2_dtype}), "
"and the inputs could not be safely coerced to any "
Expand Down

0 comments on commit 4366943

Please sign in to comment.