BUG: fixed #5147 collapsingbug in einsum
Merge pull request #5152 from tovrstra/collapsingbug

fixed #5147 collapsingbug in einsum