Improved performance of tranpose

* Using int instead of dim_type
* Unrolling loops using static consts
* Using output dimensions