In [1]:
import torch
In [2]:
x = torch.arange(18).view(3, 2, 3)
x
Out[2]:
tensor([[[ 0,  1,  2],
         [ 3,  4,  5]],

        [[ 6,  7,  8],
         [ 9, 10, 11]],

        [[12, 13, 14],
         [15, 16, 17]]])
In [3]:
x[1, 1, 1]
Out[3]:
tensor(10)
In [4]:
x[1, 0:2, 1]
Out[4]:
tensor([ 7, 10])
In [5]:
x[1, 0:2, 0:5]
Out[5]:
tensor([[ 6,  7,  8],
        [ 9, 10, 11]])
In [6]:
x[1, :, :]
Out[6]:
tensor([[ 6,  7,  8],
        [ 9, 10, 11]])