Hi,
You can get the permutation by calling perm = hc1.argsort(dim=0).squeeze().
In your example it returns tensor([2, 1, 0, 4, 3])
Then you can rearrange hc2 with this permutation : hc2_rearranged = hc2[perm].
In your example it returns
tensor([[3.],
        [2.],
        [1.],
        [5.],
        [4.]])

You can always concatenate those afterwards