mozga-intel commented on a change in pull request #20633:
URL: https://github.com/apache/incubator-mxnet/pull/20633#discussion_r722384932
##########
File path: python/mxnet/numpy/linalg.py
##########
@@ -67,6 +70,53 @@ def matrix_rank(M, tol=None, hermitian=False):
return _mx_nd_np.linalg.matrix_rank(M, tol, hermitian)
+def vecdot(a: ndarray, b, ndarray, axis: Optional[int] =None) -> ndarray:
+ r"""
+ Return the dot product of two vectors.
+ Note that `vecdot` handles multidimensional arrays differently than `dot`:
+ it does *not* perform a matrix product, but flattens input arguments
+ to 1-D vectors first. Consequently, it should only be used for vectors.
+
+ Parameters
+ ----------
+ a : ndarray
+ First argument to the dot product.
+ b : ndarray
+ Second argument to the dot product.
+ axis : axis over which to compute the dot product. Must be an integer on
+ the interval [-N, N) , where N is the rank (number of dimensions) of
+ the shape determined according to Broadcasting . If specified as a
+ negative integer, the function must determine the axis along which
+ to compute the dot product by counting backward from the last dimension
+ (where -1 refers to the last dimension). If None , the function must
+ compute the dot product over the last axis. Default: None .
+
+ Returns
+ -------
+ output : ndarray
+ Dot product of `a` and `b`.
+
+ See Also
+ --------
+ dot : Return the dot product without using the complex conjugate of the
+ first argument.
+
+ Examples
+ --------
+ Note that higher-dimensional arrays are flattened!
+
+ >>> a = np.array([[1, 4], [5, 6]])
+ >>> b = np.array([[4, 1], [2, 2]])
+ >>> np.vecdot(a, b)
+ array(30.)
+ >>> np.vecdot(b, a)
Review comment:
```suggestion
>>> np.linalg.vecdot(b, a)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]