You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spec/API_specification/linear_algebra_functions.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ The `matmul` function must implement the same semantics as the built-in `@` oper
34
34
35
35
-**x1**: _<array>_
36
36
37
-
- first input array. Should have a numeric data type. Must have at least one dimension. If `x1` is one-dimensional having shape `(M)` and `x2` has more than one dimension, `x1` must be promoted to a two-dimensional array by prepending `1` to its dimensions (i.e., must have shape `(1, M)`). After matrix multiplication, the prepended dimensions in the returned array must be removed. If `x1` has more than one dimension (including after vector-to-matrix promotion), `x1` must be compatible with `x2` (see {ref}`broadcasting`). If `x1` has shape `(..., M, K)`, the innermost two dimensions form matrices on which to perform matrix multiplication.
37
+
- first input array. Should have a numeric data type. Must have at least one dimension. If `x1` is one-dimensional having shape `(M)` and `x2` has more than one dimension, `x1` must be promoted to a two-dimensional array by prepending `1` to its dimensions (i.e., must have shape `(1, M)`). After matrix multiplication, the prepended dimensions in the returned array must be removed. If `x1` has more than one dimension (including after vector-to-matrix promotion), `x1` must be compatible with `x2` (see {ref}`broadcasting`). If `x1` has shape `(..., M, K)`, the innermost two dimensions form matrices on which to perform matrix multiplication.
38
38
39
39
-**x2**: _<array>_
40
40
@@ -58,7 +58,7 @@ The `matmul` function must implement the same semantics as the built-in `@` oper
58
58
59
59
- if either `x1` or `x2` is a zero-dimensional array.
60
60
- if `x1` is a one-dimensional array having shape `(N)`, `x2` is a one-dimensional array having shape `(M)`, and `N != M`.
61
-
- if `x1` is an array having shape `(..., M, K)`, `x2` is an array having shape `(..., L, N)`, and `K != L`.
61
+
- if `x1` is an array having shape `(..., M, K)`, `x2` is an array having shape `(..., L, N)`, and `K != L`.
62
62
63
63
(function-tensordot)=
64
64
### tensordot(x1, x2, /, *, axes=2)
@@ -78,13 +78,13 @@ Returns a tensor contraction of `x1` and `x2` over specific axes.
78
78
-**axes**: _Union\[ int, Tuple\[ Sequence\[ int ], Sequence\[ int ]]]_
79
79
80
80
- number of axes (dimensions) to contract or explicit sequences of axes (dimensions) for `x1` and `x2`, respectively.
81
-
81
+
82
82
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.
83
83
84
84
- If `N` equals `0`, the result is the tensor (outer) product.
85
85
- If `N` equals `1`, the result is the tensor dot product.
86
86
- If `N` equals `2`, the result is the tensor double contraction (default).
87
-
87
+
88
88
If `axes` is a tuple of two sequences `(x1_axes, x2_axes)`, the first sequence must apply to `x` 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.
89
89
90
90
#### Returns
@@ -135,7 +135,7 @@ Computes the (vector) dot product of two arrays.
135
135
136
136
#### Returns
137
137
138
-
-**out**: _<array;>_
138
+
-**out**: _<array>_
139
139
140
140
- if `x1` and `x2` are both one-dimensional arrays, a zero-dimensional containing the dot product; otherwise, a non-zero-dimensional array containing the dot products and having rank `N-1`, where `N` is the rank (number of dimensions) of the shape determined according to {ref}`broadcasting`. The returned array must have a data type determined by {ref}`type-promotion`.
0 commit comments