[GitHub] [singa] dcslin commented on issue #639: added support for matmul 3d 4d

2020-03-29 Thread GitBox
dcslin commented on issue #639: added support for matmul 3d 4d
URL: https://github.com/apache/singa/pull/639#issuecomment-605794131
 
 
   > Is it called batched matmul or batched gemm?
   > Seems different to tensordot.
   > since the API for matmul remains the same, we may need to update the 
DocString.
   
   In the high level API, `batch matmul` is ok, I see people calling it this 
way. In numpy, all `matmul` are call `matmul`.
   
   In the low level API, cublas calls it `Batched GEMM`, cblas also does 
similarly.
   
   I have update `singa/tensor.py` docstring to cover 3 cases:
   1. 2d*1d matrix to vector
   2. 2d*2d matrix to matrix
   3. 3/4d*3/4d batched matrix to matrix


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [singa] dcslin commented on issue #639: added support for matmul 3d 4d

2020-03-29 Thread GitBox
dcslin commented on issue #639: added support for matmul 3d 4d
URL: https://github.com/apache/singa/pull/639#issuecomment-605793210
 
 
   > is matmul different to tensordot?
   > why not call tensordot to implement it?
   
   Batch matmul could not be implemented by tensordot, as matmul is not really 
tensor dot.
   Batch matmul could be illustrated by einsum:
   ``` python
   >>> x1.shape
   (2, 3, 4, 5)
   >>> x2.shape
   (2, 3, 5, 6)
   >>> np.testing.assert_almost_equal(np.matmul(x1,x2), 
np.einsum('ijkl,ijlm->ijkm',x1,x2))
   # output is (2,3,4,6)
   ```
   
   
   Boardcasting matmul could be implemented by tensordot:
   ```
   >>> x1.shape
   (2, 3, 4, 5)
   >>> x3.shape
   (5, 6)
   >>> np.testing.assert_almost_equal(np.matmul(x1,x3), 
np.tensordot(x1,x3,axes=([3],[0])))
   # output is (2,3,4,6)
   ```


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [singa] dcslin commented on issue #639: added support for matmul 3d 4d

2020-03-28 Thread GitBox
dcslin commented on issue #639: added support for matmul 3d 4d
URL: https://github.com/apache/singa/pull/639#issuecomment-605449807
 
 
   fix https://github.com/apache/singa/issues/634 follow up issue


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [singa] dcslin commented on issue #639: added support for matmul 3d 4d

2020-03-25 Thread GitBox
dcslin commented on issue #639: added support for matmul 3d 4d
URL: https://github.com/apache/singa/pull/639#issuecomment-604210356
 
 
   fix issue: https://github.com/apache/singa/issues/634


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:
us...@infra.apache.org


With regards,
Apache Git Services