Added more optimizations for Tensor permutation constructors.