I have a pytorch tensor with an arbitrary number of dimensions : ...X,Y,Z
I would like to have a function such that I give a number C, and I get the ...,C,Y,Z
my_matrix = [:,:,C,:,:]
But I dont know how many trailing dimensions are before C, I saw an answer with using tuples of slices but can seem to get it to work. Partial slices in pytorch / numpy with arbitrary and variable number of dimensions