- tensordot(x1: array, x2: array, /, *, axes: Union[int, Tuple[Sequence[int], Sequence[int]]] = 2) array ¶
Returns a tensor contraction of
x2over specific axes.
x1 (array) – first input array. Should have a numeric data type.
x2 (array) –
second input array. Should have a numeric data type. Corresponding contracted axes of
x2must be equal.
Contracted axes (dimensions) must not be broadcasted.
axes (Union[int, Tuple[Sequence[int], Sequence[int]]]) –
number of axes (dimensions) to contract or explicit sequences of axes (dimensions) for
N, then contraction must be performed over the last
x1and the first
x2in order. The size of each corresponding axis (dimension) must match. Must be nonnegative.
0, the result is the tensor (outer) product.
1, the result is the tensor dot product.
2, the result is the tensor double contraction (default).
axesis a tuple of two sequences
(x1_axes, x2_axes), the first sequence must apply to
xand the second sequence to
x2. Both sequences must have the same length. Each axis (dimension)
x1must have the same size as the respective axis (dimension)
x2. Each sequence must consist of unique (nonnegative) integers that specify valid axes for each respective array.
out (array) – an array containing the tensor contraction whose shape consists of the non-contracted axes (dimensions) of the first array
x1, followed by the non-contracted axes (dimensions) of the second array
x2. The returned array must have a data type determined by Type Promotion Rules.