Add Sequence Concat Operator.
Created by: Yancey1989
Case1
输入的Lod信息相同,Element的维度不同,按axis进行拼接
属性
level = 1
: 按sentence进行拼接
axis = 2
: 对输入的LodTensor按Level做Level Slice,对Level Slice后的Tensor按第2
维进行拼接
输入
Input(x0), Lod={{0,2,5,11},{0,2,3,5,6,8,11}}, element dims=<2,3,4>
3 (batch size = 3)
1 2 3
2 1 2 1 2 3
|| | || | || |||
- Tensor[0].dims = <2,2,3,4>
- Tensor[1].dims = <3,2,3,4>
- Tensor[2].dims = <6,2,3,4>
Input(x1), Lod={{0,2,5,11},{0,2,3,5,6,8,11}}, element dims=<2,2,4>
3 (batch size = 3)
1 2 3
2 1 2 1 2 3
|| | || | || |||
- Tensor[0].dims = <2,2,2,4>
- Tensor[1].dims = <3,2,2,4>
- Tensor[2].dims = <6,2,3,4>
输出
Output(Out), Lod={{0,2,5,11},{0,2,3,5,6,8,11}}, element dims=<2,5,4>
3 (batch size = 3)
1 2 3
2 1 2 1 2 3
|| | || | || |||
- Tensor[0].dims = <2,2,5,4>
- Tensor[1].dims = <3,2,5,4>
- Tensor[2].dims = <6,2,5,4>
Case 2
Lod信息不同,Element的维度相同,拼接后输出的Lod信息改变
参数
level=1
:按sentence拼接
axis=0
: 对输入的LodTensor做Level Slice,对Level Slice后的Tensor按第0维进行拼接
输入
Input(x0), Lod={{0,2,5,11},{0,2,3,5,6,8,11}}, element dims=<2,3,4>
3 (batch size = 3)
1 2 3
2 1 2 1 2 3
|| | || | || |||
- Tensor[0].dims = <2,2,3,4>
- Tensor[1].dims = <3,2,3,4>
- Tensor[2].dims = <5,2,3,4>
Input(x1), Lod={{0,6,9,10},{0,1,3,6,7,9,10}}, element dims=<2,3,4>
3 (batch size = 3)
3 2 1
1 2 3 1 2 1
| || ||| | || |
- Tensor[0].dims = <6,2,3,4>
- Tensor[1].dims = <3,2,3,4>
- Tensor[2].dims = <1,2,3,4>
输出
Output(Out), Lod={{0,8,14, 21},{0,2,3,5,8,9,11,12,14,15,17,20,21}}, element dims=<2,3,4>
3(batch size = 3)
4 4 4
2 1 2 3 1 2 1 2 1 2 3 1
|| | || ||| | || | || | || ||| |
- Tensor[0].dims = <8,2,3,4>
- Tensor[1].dims = <6,2,3,4>
- Tensor[2].dims = <7,2,3,4>