In Torch / PyTorch you can use the narrow(dimension, start, length) method (ref. 180), which allows you to get a smaller range (length) of a given dimension at a specific starting point (so, you’ll end up with the same number of dimensions).
Use instead the select(dimension, index) method (ref. 140) to choose a specific index of one dimension (you’ll end up with one less number of dimensions).