You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@singa.apache.org by GitBox <gi...@apache.org> on 2020/03/26 03:35:57 UTC

[GitHub] [singa] dcslin opened a new pull request #639: added support for matmul 3d 4d

dcslin opened a new pull request #639: added support for matmul 3d 4d
URL: https://github.com/apache/singa/pull/639
 
 
   

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


With regards,
Apache Git Services

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

Posted by GitBox <gi...@apache.org>.
dcslin edited a comment 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 called `matmul`.
   
   In the low level API, cublas calls it `Batched GEMM`, cblas also does similarly.
   
   I have updated `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:
users@infra.apache.org


With regards,
Apache Git Services

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

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org


With regards,
Apache Git Services

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

Posted by GitBox <gi...@apache.org>.
dcslin edited a comment 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 batch 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:
users@infra.apache.org


With regards,
Apache Git Services

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

Posted by GitBox <gi...@apache.org>.
nudles commented on issue #639: added support for matmul 3d 4d
URL: https://github.com/apache/singa/pull/639#issuecomment-605541843
 
 
   is matmul different to tensordot?
   why not call tensordot to implement it?

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


With regards,
Apache Git Services

[GitHub] [singa] nudles merged pull request #639: added support for matmul 3d 4d

Posted by GitBox <gi...@apache.org>.
nudles merged pull request #639: added support for matmul 3d 4d
URL: https://github.com/apache/singa/pull/639
 
 
   

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


With regards,
Apache Git Services

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

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org


With regards,
Apache Git Services

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

Posted by GitBox <gi...@apache.org>.
dcslin edited a comment 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 batch 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:
   ``` python
   >>> 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:
users@infra.apache.org


With regards,
Apache Git Services

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

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org


With regards,
Apache Git Services

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

Posted by GitBox <gi...@apache.org>.
dcslin edited a comment 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 updated `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:
users@infra.apache.org


With regards,
Apache Git Services

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

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org


With regards,
Apache Git Services

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

Posted by GitBox <gi...@apache.org>.
nudles commented on issue #639: added support for matmul 3d 4d
URL: https://github.com/apache/singa/pull/639#issuecomment-605542191
 
 
   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.

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


With regards,
Apache Git Services