I'm multiplying two matrix of shape (3,2,2,2) and shape (2,2,2,2) which as far as I understand should multiply correctly.
np.random.randn(3,2,2,2)@np.random.randn(2,2,2,2)
Raises the error
ValueError: operands could not be broadcast together with remapped shapes [original->remapped]: (3,2,2,2)->(3,2,newaxis,newaxis) (2,2,2,2)->(2,2,newaxis,newaxis) and requested shape (2,2)
Seeing it in the context of 3x2 and 2x2 matrix with each element as 2x2, the matrix multiplication should work correctly, but doesn't. Looking for correction here.
Edit: using np.dot(np.random.randn(3,2,2,2),np.random.randn(2,2,2,2))
does result in a valid multiplication however, the resultant shape is (3,2,2,2,2,2)
which is not expected. Following conventional rules the output shape should be (3,2,2,2)
.