Zha0q1 opened a new issue #19441:
URL: https://github.com/apache/incubator-mxnet/issues/19441


   This is how we define the numpy vdot operator. I think by calling 
`.flatten()` we basically create a copy of the input so the grad of the 
original input is not updated
   ```python
   @set_module('mxnet.ndarray.numpy')
   def vdot(a, b):
       r"""
       Return the dot product of two vectors.
       Note that `vdot` 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.
   
       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.vdot(a, b)
       30
       >>> np.vdot(b, a)
       30
       >>> 1*4 + 4*1 + 5*2 + 6*2
       30
       """
       return tensordot(a.flatten(), b.flatten(), 1)
   ```


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to