Skip to content

Commit 07043a0

Browse files
committed
Conjugate the first argument in vecdot
Note that PyTorch uses its own vecdot directly for complex inputs,, which already does conjugation. This is currently untested by the test suite (data-apis/array-api-tests#312) Fixes #200.
1 parent 8d3f5d5 commit 07043a0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

array_api_compat/common/_aliases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ def vecdot(x1: ndarray, x2: ndarray, /, xp, *, axis: int = -1) -> ndarray:
479479
x2_ = xp.moveaxis(x2, axis, -1)
480480
x1_, x2_ = _broadcast(x1_, x2_)
481481

482-
res = x1_[..., None, :] @ x2_[..., None]
482+
res = xp.conj(x1_[..., None, :]) @ x2_[..., None]
483483
return res[..., 0, 0]
484484

485485
# isdtype is a new function in the 2022.12 array API specification.

0 commit comments

Comments
 (0)