gather

    根据索引 index 获取输入 input 的最外层维度的条目,并将它们拼接在一起。

    • input (Tensor) - 输入, 秩 rank >= 1 , 支持的数据类型包括 int32、int64、float32、float64 和 uint8 (CPU)、float16(GPU) 。

    返回:和输入的秩相同的输出张量。

    代码示例

    1. x = fluid.layers.data(name='x', shape=[-1, 5], dtype='float32')
    2. output = fluid.layers.gather(x, index)