Added a function to permute tensors, deleted aif2, it was not used.