I have a 3D tensor of size (8,8,2052), all zeros. This will be the mask.
Also, there is a tensor of size (29, 3), which is basically a list of indices that need to be 1 in the mask.
Is there a pytorch way of doing this? im avoiding using python for
loop, to iterate over the indices’ list.
so far i tried the following: take, index_select, “smart” indexing…
i put a lot of time on this, tried a lot of approaches and nothing seems to give me what im looking for.
Any ideas?
Here is an example of the indices list:
tensor([[0, 1, 0],
[0, 2, 0],
[0, 7, 0],
[1, 2, 0],
[1, 3, 0],
[1, 4, 0],
[1, 6, 0],
[1, 7, 0],
[2, 2, 0],
[3, 3, 0],
[3, 4, 0],
[4, 0, 0],
[4, 2, 0],
[4, 4, 0],
[4, 6, 0],
[5, 0, 0],
[5, 4, 0],
[5, 5, 0],
[5, 6, 0],
[6, 0, 0],
[6, 2, 0],
[6, 4, 0],
[6, 5, 0],
[6, 6, 4],
[7, 0, 0],
[7, 2, 1],
[7, 4, 2],
[7, 5, 40],
[7, 6, 0]])