>>> import numpy as np
>>> np.take_along_axis(x, idx[np.newaxis], -1)
array([[[ 0.21132487, 0.78867513, -0.21132487, -0.78867513],
[ 0.21132487, 0.78867513, -0.21132487, -0.78867513],
[ 0.21132487, 0.78867513, -0.21132487, -0.78867513],
[ 0.21132487, 0.78867513, -0.21132487, -0.78867513]],
[[ 0.21132487, 0.78867513, -0.21132487, -0.78867513],
[ 0.21132487, 0.78867513, -0.21132487, -0.78867513],
[ 0.21132487, 0.78867513, -0.21132487, -0.78867513],
[ 0.21132487, 0.78867513, -0.21132487, -0.78867513]]])
https://numpy.org/doc/stable/reference/generated/numpy.take_along_axis.html