LodExtend Operator
Created by: Superjomn
According to the design of sequence decoder, a LodExtend Operator is needed to link the previous state to the current state of RNN/sequence decoder.
It functions like
- inputs
- source : LoDTensor
- target, the lod to fit, LoDTensor
- outputs
- the expanded source that has the same LoD with target
Some real examples:
- source: a 1-level LoDTensor with 2 sequences
- LoD:
[0, 3, 5]
- data:
[0, 1, 2, 3, 4, 5]
- LoD:
- target: a 1-level LoDTensor with 5 sequences
- LoD:
[0, 2, 3, 5, 6, 6, 8]
- LoD:
- output:
- LoD same with target
- data:
[0, 0, 1, 2, 2, 3, 5, 5]
The function LodExpand in another PR can be used.