multi_dot#
- ivy.multi_dot(x, /, *, out=None)[source]#
Compute the dot product of two or more matrices in a single function call, while selecting the fastest evaluation order.
- Parameters:
- Return type:
- Returns:
ret – dot product of the arrays.
Examples
With
ivy.Array
input:>>> A = ivy.arange(2 * 3).reshape((2, 3)) >>> B = ivy.arange(3 * 2).reshape((3, 2)) >>> C = ivy.arange(2 * 2).reshape((2, 2)) >>> ivy.multi_dot((A, B, C)) ivy.array([[ 26, 49], [ 80, 148]])
>>> A = ivy.arange(2 * 3).reshape((2, 3)) >>> B = ivy.arange(3 * 2).reshape((3, 2)) >>> C = ivy.arange(2 * 2).reshape((2, 2)) >>> D = ivy.zeros((2, 2)) >>> ivy.multi_dot((A, B, C), out=D) >>> print(D) ivy.array([[ 26, 49], [ 80, 148]])
- Array.multi_dot(self, x, /, *, out=None)[source]#
ivy.Array instance method variant of ivy.multi_dot. This method simply wraps the function, and so the docstring for ivy.multi_dot also applies to this method with minimal changes.
- Return type:
Array
Examples
>>> A = ivy.arange(2 * 3).reshape((2, 3)) >>> B = ivy.arange(3 * 2).reshape((3, 2)) >>> C = ivy.arange(2 * 2).reshape((2, 2)) >>> A.multi_dot((B, C)) ivy.array([[ 26, 49], [ 80, 148]])
- Container.multi_dot(self, arrays, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=True, out=None)[source]#
ivy.Container instance method variant of ivy.multi_dot. This method simply wraps the function, and so the docstring for ivy.multi_dot also applies to this method with minimal changes.
- Return type:
Container
Examples
>>> a = ivy.Container(x=ivy.arange(2 * 3).reshape((2, 3)), ... y=ivy.arange(2 * 3).reshape((2, 3))) >>> b = ivy.Container(x=ivy.arange(3 * 2).reshape((3, 2)), ... y=ivy.arange(3 * 2).reshape((3, 2))) >>> c = ivy.Container(x=ivy.arange(2 * 2).reshape((2, 2)), ... y=ivy.arange(2 * 2).reshape((2, 2))) >>> a.multi_dot((b, c)) { x: ivy.array([[26, 49], [80, 148]]), y: ivy.array([[26, 49], [80, 148]]) }