fixed #5147 collapsingbug in einsum

tests passed