Table Of Contents
Table Of Contents

mxnet.ndarray.batch_take

mxnet.ndarray.batch_take(a=None, indices=None, out=None, name=None, **kwargs)

Takes elements from a data batch.

Note

batch_take is deprecated. Use pick instead.

Given an input array of shape (d0, d1) and indices of shape (i0,), the result will be an output array of shape (i0,) with:

output[i] = input[i, indices[i]]

Examples:

x = [[ 1.,  2.],
     [ 3.,  4.],
     [ 5.,  6.]]

// takes elements with specified indices
batch_take(x, [0,1,0]) = [ 1.  4.  5.]

Defined in src/operator/tensor/indexing_op.cc:L750

Parameters
  • a (NDArray) – The input array

  • indices (NDArray) – The index array

  • out (NDArray, optional) – The output NDArray to hold the result.

Returns

out – The output of this function.

Return type

NDArray or list of NDArrays