qml.math.gather

gather(tensor, indices)[source]

Gather tensor values given a tuple of indices.

This is equivalent to the following NumPy fancy indexing:

..code-block:: python

tensor[array(indices)]

Parameters
  • tensor (tensor_like) – tensor to gather from

  • indices (Sequence[int]) – the indices of the values to extract

Returns

the gathered tensor values

Return type

tensor_like

See also

take()