ok, but how do I fetch those x values that match the ids?
my output of shape (5,10,1) are only the max values of x with respect to last dimension.
In a simple 2D case:
x = [ [1,2,3],
[4, 5, 2]]
ids = [2,1] # 2 because of fetching ‘3’ and 1 because of fetching ‘5’
then i want my output to be
[3,5]. Right?
Small followup tho. lets say you have
x = tc.randn(5,10,15,20)
indexes # shape of 5,10
so now the indexes tell me which guy from dim=2 is the best, but then this best guy has a dimenions of not 1, but 20. How can apply indexes to x now? In a for loop it would be like:
in order to use gather i need to have x and ids of the same shape except on dim.
in my new case the shapes are
x - (5,10,15,20)
ids - (5,10)
I can use unsqueeze to make shape of ids either (5,10,1) or (5,10,1,1) but it still wont match the shape of x.