@@ -31,7 +31,7 @@ def matmul(x1: Array, x2: Array, /) -> Array:
3131 raise TypeError ('Only numeric dtypes are allowed in matmul' )
3232
3333 if x1 .device != x2 .device :
34- raise RuntimeError (f"Arrays from two different devices ({ x1 .device } and { x2 .device } ) can not be combined." )
34+ raise ValueError (f"Arrays from two different devices ({ x1 .device } and { x2 .device } ) can not be combined." )
3535
3636 return Array ._new (np .matmul (x1 ._array , x2 ._array ), device = x1 .device )
3737
@@ -45,7 +45,7 @@ def tensordot(x1: Array, x2: Array, /, *, axes: Union[int, Tuple[Sequence[int],
4545 raise TypeError ('Only numeric dtypes are allowed in tensordot' )
4646
4747 if x1 .device != x2 .device :
48- raise RuntimeError (f"Arrays from two different devices ({ x1 .device } and { x2 .device } ) can not be combined." )
48+ raise ValueError (f"Arrays from two different devices ({ x1 .device } and { x2 .device } ) can not be combined." )
4949
5050 return Array ._new (np .tensordot (x1 ._array , x2 ._array , axes = axes ), device = x1 .device )
5151
@@ -68,7 +68,7 @@ def vecdot(x1: Array, x2: Array, /, *, axis: int = -1) -> Array:
6868 raise ValueError ("axis is out of bounds for x1 and x2" )
6969
7070 if x1 .device != x2 .device :
71- raise RuntimeError (f"Arrays from two different devices ({ x1 .device } and { x2 .device } ) can not be combined." )
71+ raise ValueError (f"Arrays from two different devices ({ x1 .device } and { x2 .device } ) can not be combined." )
7272
7373 # In versions of the standard prior to 2023.12, vecdot applied axis after
7474 # broadcasting. This is different from applying it before broadcasting
0 commit comments