I am currently trying to figure out a good
index_max_ solution that doesn’t require multiple copies of the data or a loop. This would work along the lines of
index_add_ except the underlying operation is a
max instead of addition. Does anyone have a solution?
Also, are there plans for more explicitly built-in functionality along the lines of
index_copy_, etc? Even better, it would be awesome to have some sort of lambda-style of overloading for these indexing operations.
In particular, I’m finding occasions where an
index_avg_ would be useful. For example, if I have a list of indices corresponding to data (maybe nearest neighbor pointers or something similar) and I want to pool over the indices, I could use it.
For the averaging operation, I currently use
index_add_ on my data and also on a
torch.ones() vector and then do the appropriate broadcasted division. I suppose it may be more efficient to do that on the backend though.