gather

Gather collects the values at index locations indexed by the second argument. The output tensor has shape $[i_0, \ldots i_{ir}, a_0,\ldots a_{j-1},a_{j+1},\ldots a_{ar}]$ where $[a_0,\ldots,a_{ar}]$ is the shape of the first argument, and $[i_0,\ldots,i_{ir}]$ is the shape of the second second (index) argument, and $j$ is the axis along which the gather is performed.

If the index is not an integer, the gather will linearly interpolate between the values on either side. So, for example, $x[2.5] = 0.5 (x[2]+x[3])$.

If the index value is outside the range of the x-vector along the axis being gathered, then NAN is assigned to that tensor element.