Sub-2×2 matrix product within 4-dimensional tensor, along given axis
enter code here
I have a ndarray structure with 4 dimensions: (2x2xNxK). You can imagine this as K different stacks, containing each of them N matrices of dimension 2×2.
For each stack, I’m trying to compute the matrix product of its N matrices (without For loop). So in the end, I should have K matrices of dimensions 2×2 (the product of N 2×2 matrices remains a 2×2 matrix).