def inverse_permutation(perm):
 return permute_row_elements(arange(perm.shape[(-1)], dtype=perm.dtype), perm, inverse=True)

def inverse_permutation ( perm ) : return permute_row_elements ( arange ( perm . shape [ ( - 1 ) ] , dtype = perm . dtype ) , perm , inverse = True )
computes the inverse of permutations .