Tensor slicing on >3 dim tensors

If I have a tensor like a = torch.randn(N, 5, 4, H, W) and I want to get a sub-tensor in dim=2 such as a[[0, 0], [1, 2], :, [4, 5], [11, 12]]. How do I do this?

There is a discussion about advanced indexing, where your use case seems to be related to.
You could try:

a[[0, 0], ...][:, [1, 2]][:, :, :, [4, 5]][:, :, :, :, [11, 12]]

which gives a.shape=[2, 2, 4, 2, 2].