a python question: I've got a np.einsum operation that I'm doing on a pair of 3d arrays:
return np.einsum('ijk, ijk -> ik', input_array, self._beta_array)
Problem I'm having is the result is 2d; the operation collapses the 'j' dimension. What I'd love to do is to have it retain the 'j' dimension similar to how 'keepdims' works in the np.sum function.
I can wrap the result in np.expand_dims, but that seems inefficient to me. I'd prefer to find some way to tweak the einsum to output what I'm after.
Is this posible?