Consider the following:
a = torch.rand(2, 3, 4)
tensor([[[0.2410, 0.3700, 0.9221, 0.5289],
[0.8820, 0.2856, 0.4072, 0.6177],
[0.4279, 0.9396, 0.7483, 0.0087]],
[[0.7295, 0.4965, 0.9559, 0.0419],
[0.7379, 0.5761, 0.3439, 0.8682],
[0.3886, 0.2435, 0.4024, 0.2007]]])
a[[0], [0,2]][..., [0,3]]
tensor([[0.2410, 0.5289],
[0.4279, 0.0087]])
So far so good but when I try to select the same subset directly on a
I'm getting (for me) unexpected results.
a[[0], [0,2], [0,3]]
tensor([0.2410, 0.0087])
I tried to find an explanation to what exactly happening in the last case but didn't find any. I'll be happy to understand what is the semantic of this last form of indexing.
Thank you!