Skip to content

Commit 3512a49

Browse files
Replaced few TypeError with ValueError in _elementwise_common
Used ValueError instead of TypeError per Python guidelines. Inappriate uses were pointed out by @vtavana
1 parent fbe0081 commit 3512a49

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dpctl/tensor/_elementwise_common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def __call__(self, x, out=None, order="K"):
188188
acceptance_fn=self.acceptance_fn_,
189189
)
190190
if res_dt is None:
191-
raise TypeError(
191+
raise ValueError(
192192
f"function '{self.name_}' does not support input type "
193193
f"({x.dtype}), "
194194
"and the input could not be safely coerced to any "
@@ -209,7 +209,7 @@ def __call__(self, x, out=None, order="K"):
209209
)
210210

211211
if res_dt != out.dtype:
212-
raise TypeError(
212+
raise ValueError(
213213
f"Output array of type {res_dt} is needed,"
214214
f" got {out.dtype}"
215215
)
@@ -587,7 +587,7 @@ def __call__(self, o1, o2, out=None, order="K"):
587587
)
588588

589589
if res_dt is None:
590-
raise TypeError(
590+
raise ValueError(
591591
f"function '{self.name_}' does not support input types "
592592
f"({o1_dtype}, {o2_dtype}), "
593593
"and the inputs could not be safely coerced to any "
@@ -608,7 +608,7 @@ def __call__(self, o1, o2, out=None, order="K"):
608608
)
609609

610610
if res_dt != out.dtype:
611-
raise TypeError(
611+
raise ValueError(
612612
f"Output array of type {res_dt} is needed,"
613613
f"got {out.dtype}"
614614
)

0 commit comments

Comments
 (0)