Dot optimization

This is a generalization of the proposed optimization T.dot(A, B)[i] --> T.dot(A[i], B) to deal with multiple indices. For example, if A and B are matrices then T.dot(A, B)[:, i] will become T.dot(A, B[:, i]), and similarly for tensors and more indices. The tests have not yet been written.
This sentence don't seem good. I think it should be:

but not inserted in the second-to-last dimension (because dot sums over this dimension)