generalized inner product of tensors by removing basis distinction