function gather_(x, indices, axis = 0, batchDims = 0) {
    const $x = (0, _tensorUtilEnv.convertToTensor)(x, "x", "gather");
    const $indices = (0, _tensorUtilEnv.convertToTensor)(indices, "indices", "gather", "int32");
    const inputs = {
        x: $x,
        indices: $indices
    };
    const attrs = {
        axis,
        batchDims
    };
    return (0, _engine.ENGINE).runKernel((0, _kernelNames.GatherV2), inputs, attrs);
}
Gather slices from tensor `x`'s axis `axis` according to `indices`.

```js
const x = tf.tensor1d([1, 2, 3, 4]);
const indices = tf.tensor1d([1, 3, 3], 'int32');

x.gather(indices).print();
```

```js
const x = tf.tensor2d([1, 2, 3, 4], [2, 2]);
const indices = tf.tensor1d([1, 1, 0], 'int32');

x.gather(indices).print();
```
@param x The input tensor whose slices are to be gathered.
@param indices The indices of the values to extract.
@param axis The axis over which to select values. Defaults to 0.
@param batchDims Optional. The number of batch dimensions. It must be less
    than or equal to rank(indices). Defaults to 0.
    The output tensor will have shape of
    `x.shape[:axis] + indices.shape[batchDims:] + x.shape[axis + 1:]`

@doc {heading: 'Tensors', subheading: 'Slicing and Joining'}