Selects values from input at the 1-dimensional indices from indices along the given dim.
Useful links