diffrence between a[:,:,0] and a[:][:][0]
Hi I was studying slicing in python and I found something strange and I don't understand
import torch

a = torch.tensor([
    [
        [1, 2, 3],
        [4, 5, 6]
    ],
    [
        [7, 2, 3],
        [8, 5, 6]
    ]
])

&gt;&gt;&gt; a[:][:][0]
tensor([[1, 2, 3],
        [4, 5, 6]])

&gt;&gt;&gt; a[:,:,0]
tensor([[1, 4],
        [7, 8]])

I tried to pull out [[1,4,7,8]] from the corresponding torch list, so I entered a[:][:][0] and the result of it is [[1,2,3], [4,5,6]]. Then, when I input a[:,:,0], then [[1,4,7,8]] appeared.
I thought they have no different but different result appeared.
the torch and numpy operators, there was an operation like a[:,0]. How exactly can it be different from a[:][0]?

You can see the first, a[:][:][0], as several, chained calls to __getitem__. That means a[:][:][0] is roughly equivalent to this:
b = a[:]
c = b[:]
d = c[0]

Where d is the result. In your case, it returns the same thing as a[0], because a[:] == a.
In contrast, a[:,:,0] will only call __getitem__ once with parameters slice(None), slice(None), 0.
In your case, that's the first slice of your tensor on the third axis.
