gather_tree
gather_tree
(ids, parents)[源代码]
,该OP从最后一个时间步回溯产生完整的id序列。
- 参数:
- parents (Variable) - 形状和数据类型均与 相同的Tensor。包含了束搜索中每一时间步所选id对应的parent。
返回:和 ids
具有相同形状和数据类型的Tensor。包含了根据parent回溯而收集产生的完整id序列。
代码示例:
- import paddle.fluid as fluid
- ids = fluid.data(name='ids',
- dtype='int64')
- parents = fluid.data(name='parents',
- shape=[5, 2, 2],
- dtype='int64')