basically replacing elements of c using a dictionary with keys of a and values of b.
For example,
a=torch.tensor([1, 0, 3, -1, 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')

then
d = custom_map(a,b,c) # = torch.tensor([5, 5, 5, 4, 7, 6, 8], device='cuda')

is this clear enough?