You send a list with the desired indices.
For example, consider the following array:
import numpy as np
arr = np.array([[1,2], [2,3], [4,5], [6,7], [8,9]])
We can retrieve indices with the following way:
arr[[0,1,3], :]
Output:
array([[1, 2],
[2, 3],
[6, 7]])
Here I created a list of desired indices [0,1,3]
and send as retrieve the relevant dimensions.
So as for your question, you get declare whenever indices you want:
desired_indices = list(range(38,44)) + list(range(46,48)) + list(range(50,54))
my_input = x[i, :, desired_indices]
(I also change the "input" from the variable name as it will create a problem)