Skip to content

Commit 28d699c

Browse files
Changed exception types raised
Use ExecutionPlacementError for CFD violations. Use ValueError is types of input are as expected, but values are not as expected.
1 parent 7eaab6d commit 28d699c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

dpctl/tensor/_elementwise_common.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def __call__(self, x, out=None, order="K"):
7878
)
7979

8080
if out.shape != x.shape:
81-
raise TypeError(
82-
"The shape of input and output arrays are inconsistent."
81+
raise ValueError(
82+
"The shape of input and output arrays are inconsistent. "
8383
f"Expected output shape is {x.shape}, got {out.shape}"
8484
)
8585

@@ -103,7 +103,7 @@ def __call__(self, x, out=None, order="K"):
103103
dpctl.utils.get_execution_queue((x.sycl_queue, out.sycl_queue))
104104
is None
105105
):
106-
raise TypeError(
106+
raise ExecutionPlacementError(
107107
"Input and output allocation queues are not compatible"
108108
)
109109

@@ -471,8 +471,8 @@ def __call__(self, o1, o2, out=None, order="K"):
471471
)
472472

473473
if out.shape != res_shape:
474-
raise TypeError(
475-
"The shape of input and output arrays are inconsistent."
474+
raise ValueError(
475+
"The shape of input and output arrays are inconsistent. "
476476
f"Expected output shape is {o1_shape}, got {out.shape}"
477477
)
478478

@@ -486,7 +486,7 @@ def __call__(self, o1, o2, out=None, order="K"):
486486
dpctl.utils.get_execution_queue((exec_q, out.sycl_queue))
487487
is None
488488
):
489-
raise TypeError(
489+
raise ExecutionPlacementError(
490490
"Input and output allocation queues are not compatible"
491491
)
492492

0 commit comments

Comments
 (0)