chainer.functions.tensordot¶
-
chainer.functions.tensordot(a, b, axes=2)[source]¶ Returns the tensor dot product of two arrays along specified axes.
This is equivalent to compute dot product along the specified axes which are treated as one axis by reshaping.
Parameters: - a (
Variableor N-dimensional array) – The first argument. - b (
Variableor N-dimensional array) – The second argument. - axes –
- If it is an integer, then
axesaxes at the last ofaand the first ofbare used. - If it is a pair of sequences of integers, then these two
sequences specify the list of axes for
aandb. The corresponding axes are paired for sum-product.
- If it is an integer, then
Returns: The tensor dot product of
aandbalong the axes specified byaxes.Return type: Example
>>> a = np.random.rand(5, 3, 2) >>> b = np.random.rand(3, 2, 4) >>> c = F.tensordot(a, b, axes=2) >>> c.shape (5, 4)
See also
- a (