Sorry for the stupid question, but i cannot find a fast way to solve my issue, so i thought maybe the experts here can help me with that or maybe pytorch has a function that already does this in a fast way.
I have a Tensor with size of BxRxC:
e.g.
here T has dimension of 1x3x4
T = torch.round(torch.rand(1,3,4)*10)
T =
6 8 10 8
2 4 7 2
5 0 4 1
Now i have another tensor (K) with way larger size, i know that tensor K includes values of each row of Tensor tensor T somewhere in it as well as other values, but i dont know where they are
e.g.
here K has dimension of 1x9x4
K = torch.cat((torch.round(torch.rand(1,3,4)*10),T, torch.zeros(1,3,4)),1)
K =
5 7 8 1
8 2 7 8
0 10 8 8
6 8 10 8
2 4 7 2
5 0 4 1
0 0 0 0
0 0 0 0
0 0 0 0
as we can see K has the values of T in row: 1,4, and 5
in terms of size B and C will always be the same in both T and K.
How I can get the row indexes in K that includes the values in T?
Also if I have another tensor D and lets say I have the indexes for the rows from last steps, how I can extract only the values in the rows of tensor D based on the indexes that i got, meaning that if D is:
D = torch.round(torch.rand(1,9,4)*10)
D =
2 6 8 7
3 3 9 9
4 4 4 4
2 7 5 2
3 1 9 7
3 4 4 7
1 5 2 1
3 7 1 7
5 9 8 10
I want the output be
O =
2 7 5 2
3 1 9 7
3 4 4 7
my output will be the same size as T,
P.s. I just multiplied the number with 10 to make it easier for reading purposes, they are not integer all the time.