Hello !

I have a batch of tensor that represent a permutation of label called label_perm.

I have another batch tensor called node_label that give the label of each node.

I want to have a batch tensor of node index called res that follow the order of the label_perm :

for example :

label_perm = [[0,1,2]] #the label 0 is the first, the label 1 come after and finally the label 2

node_label = [[1,2,1,0,1,1,2]] # each node has a label

res = [[3,0,2,4,5,1,6]]

The first label in label_perm is 0 and only the node 3 has label 0. Then the second label is 1 so the node 0,2,4,5 have label 1 and so on …

Do you know how to do this in torch with an arbitrary batch size ?

Thanks you very much !