consider
a=torch.tensor([0, 1, 2, 3, 4], device='cuda')
b=torch.tensor([4, 5, 6, 7, 8], device='cuda')
c=torch.tensor([0, 0, 0, 1, 1, 3, 4], device='cuda')

how can I get d=torch.tensor([4, 4, 4, 5, 5, 7, 8], device='cuda')
without converting to regular list, or offloading to cpu?
(if they were regular lists, something as simple as
mapping = dict(zip(a, b))
d = map(mapping.get, c)

would’ve worked. )