In the numpy dot(...) function documentation it is said that:
If a is an N-D array and b is an M-D array (where M>=2), it is a sum product over the last axis of a and the second-to-last axis of b:
dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m])
This is sensibly different from the matmul(...) function, where the matrices product over the last two dimensions is simply broadcasted along the first dimensions (if the matrix has more than 2 dimensions).
However, while it is clear the utility of the matmul behaviour, I wonder what the possible applications are for the result given by dot(...) for matrix with more than 2 dimensions. Is there any pratical application where dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m]) can be useful?