Concatenate ":" to array values

I have the tensor x=[ [0,1],[2,3] ]. I want to concatenate “:” with tensor x[0] and x[1] such that output will be x=[ [:,0,1],[:,2,3] ]. I want to use x as indexing.

I don’t quite understand the use case. Could you post an example input tensor and how the desired indexing would work to create the desired output tensor?

I liked your post Extract batchwise multiple coordinates with pytorch functions (similar to tf.gather_nd) - #5 by ptrblck.