sponge.function.gather_value

View Source On Gitee
sponge.function.gather_value(tensor: Tensor, index: Tensor)[source]

Gather value from the last axis (axis=-1) of the tensor according to index.

Parameters
  • tensor (Tensor) – Tensor of shape (B, X), where \(B\) is batch_size, and \(X\) is an arbitrary value.

  • index (Tensor) – Tensor of shape (B, …,). Data type is int.

Returns

value (Tensor), a tensor of shape (B, …,) .

Supported Platforms:

Ascend GPU