Evaluation order for advanced indexing

Consider a source tensor src and a destination tensor dst of the same size:

src = torch.rand(n,m)
dst = torch.zeros_like(src)

Furthermore, let’s assume we are given an index tensor idx of size (2,n*m) in which each column idx[:,j] contains a target index for the corresponding entry src.view(-1)[j]. We can map src.view(-1)[j] to its target index in dst via

dst[tuple(idx)] = src.view(-1)

However, if this mapping is not 1-to-1, i.e., if several entries in src map to the same entry in dst, the evaluation order on the GPU seems to be random. In my case, though, I need to rely on a left-to-right evaluation, i.e., if a target index appears multiple times in idx, I want to write the value in src corresponding to the last appearance of the target index in idx. Any ideas how to achieve this?