Matmul rework
Compare changes
- Houssem ROUIS authored
+ 7
− 8
@@ -20,6 +20,9 @@
@@ -20,6 +20,9 @@
@@ -27,18 +30,14 @@ void Aidge::MatMul_Op::computeOutputDims() {
@@ -27,18 +30,14 @@ void Aidge::MatMul_Op::computeOutputDims() {
[ADD] support for Multi-dimensional Matrix Multiplication, following numpy MatMul operation specificities.
In the context of Multi-dimensional MatMul, we consider an N-Dim Tensor as a stack of 2-D matrices having as shape the last two dimensions of the Tensor.
From Numpy documentation:
The behavior depends on the arguments in the following way.
- If both arguments are 2-D they are multiplied like conventional matrices.
- If either argument is N-D, N > 2, it is treated as a stack of matrices residing in the last two indexes and broadcast accordingly.
- If the first argument is 1-D, it is promoted to a matrix by prepending a 1 to its dimensions. After matrix multiplication the prepended 1 is removed.
- If the second argument is 1-D, it is promoted to a matrix by appending a 1 to its dimensions. After matrix multiplication the appended 1 is removed.
Copyright © Eclipse Foundation, Inc. All Rights Reserved. Privacy Policy | Terms of Use | Copyright Agent