You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by gi...@git.apache.org on 2017/09/28 07:40:40 UTC

[GitHub] sxjscience commented on issue #4577: how to use mx.sym.dot

sxjscience commented on issue #4577: how to use mx.sym.dot
URL: https://github.com/apache/incubator-mxnet/issues/4577#issuecomment-332754817
 
 
   @Eshter
   
   For example, assume `MatA` has shape (B, 1, C) and `MatB` also has shape (B, 1, C). Our goal is to get the `ret` of size (B, 1, 1) by dot-multiply the corresponding row-vectors in two matrices.
   
   There are two ways to achieve this:
   
   1) Elementwise multiplication and use `mx.nd.sum`
   ```python
   ret = mx.nd.sum(MatA * MatB, axis=-1, keepdims=True)
   ```
   2) Use `mx.nd.batch_dot`
   ```python
   ret = mx.nd.batch_dot(MatA, MatB, transpose_b=True)
   ```
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services