@@ -31,7 +31,7 @@ def matmul(x1: Array, x2: Array, /) -> Array:
31
31
raise TypeError ('Only numeric dtypes are allowed in matmul' )
32
32
33
33
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." )
35
35
36
36
return Array ._new (np .matmul (x1 ._array , x2 ._array ), device = x1 .device )
37
37
@@ -45,7 +45,7 @@ def tensordot(x1: Array, x2: Array, /, *, axes: Union[int, Tuple[Sequence[int],
45
45
raise TypeError ('Only numeric dtypes are allowed in tensordot' )
46
46
47
47
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." )
49
49
50
50
return Array ._new (np .tensordot (x1 ._array , x2 ._array , axes = axes ), device = x1 .device )
51
51
@@ -68,7 +68,7 @@ def vecdot(x1: Array, x2: Array, /, *, axis: int = -1) -> Array:
68
68
raise ValueError ("axis is out of bounds for x1 and x2" )
69
69
70
70
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." )
72
72
73
73
# In versions of the standard prior to 2023.12, vecdot applied axis after
74
74
# broadcasting. This is different from applying it before broadcasting
0 commit comments