Skip to content

Commit 8c42f02

Browse files
asmeurerkgryte
andauthored
Allow negative axes in tensordot
PR-URL: #625 Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Athan Reines <[email protected]>
1 parent dea5791 commit 8c42f02

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/array_api_stubs/_draft/linear_algebra_functions.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ def tensordot(
9292
Contracted axes (dimensions) must not be broadcasted.
9393
9494
axes: Union[int, Tuple[Sequence[int], Sequence[int]]]
95-
number of axes (dimensions) to contract or explicit sequences of axes (dimensions) for ``x1`` and ``x2``, respectively.
95+
number of axes (dimensions) to contract or explicit sequences of axis (dimension) indices for ``x1`` and ``x2``, respectively.
9696
9797
If ``axes`` is an ``int`` equal to ``N``, then contraction must be performed over the last ``N`` axes of ``x1`` and the first ``N`` axes of ``x2`` in order. The size of each corresponding axis (dimension) must match. Must be nonnegative.
9898
9999
- If ``N`` equals ``0``, the result is the tensor (outer) product.
100100
- If ``N`` equals ``1``, the result is the tensor dot product.
101101
- If ``N`` equals ``2``, the result is the tensor double contraction (default).
102102
103-
If ``axes`` is a tuple of two sequences ``(x1_axes, x2_axes)``, the first sequence must apply to ``x1`` and the second sequence to ``x2``. Both sequences must have the same length. Each axis (dimension) ``x1_axes[i]`` for ``x1`` must have the same size as the respective axis (dimension) ``x2_axes[i]`` for ``x2``. Each sequence must consist of unique (nonnegative) integers that specify valid axes for each respective array.
103+
If ``axes`` is a tuple of two sequences ``(x1_axes, x2_axes)``, the first sequence must apply to ``x1`` and the second sequence to ``x2``. Both sequences must have the same length. Each axis (dimension) ``x1_axes[i]`` for ``x1`` must have the same size as the respective axis (dimension) ``x2_axes[i]`` for ``x2``. Each index referred to in a sequence must be unique. If ``x1`` has rank (i.e, number of dimensions) ``N``, a valid ``x1`` axis must reside on the half-open interval ``[-N, N)``. If ``x2`` has rank ``M``, a valid ``x2`` axis must reside on the half-open interval ``[-M, M)``.
104104
105105
106106
.. note::

0 commit comments

Comments
 (0)