@@ -1621,13 +1621,13 @@ def sequence_pool(input, pool_type):
1621
1621
.. code-block:: text
1622
1622
1623
1623
x is a 1-level LoDTensor:
1624
- x.lod = [[0, 2, 5, 7 ]]
1624
+ x.lod = [[2, 3, 2 ]]
1625
1625
x.data = [1, 3, 2, 4, 6, 5, 1]
1626
1626
x.dims = [7, 1]
1627
1627
1628
1628
then output is a Tensor:
1629
1629
out.dim = [3, 1]
1630
- with condition len(x.lod[-1]) - 1 == out.dims[0]
1630
+ with condition len(x.lod[-1]) == out.dims[0]
1631
1631
1632
1632
for different pool_type:
1633
1633
average: out.data = [2, 4, 3], where 2=(1+3)/2, 4=(2+4+6)/3, 3=(5+1)/2
@@ -1686,13 +1686,13 @@ def sequence_first_step(input):
1686
1686
.. code-block:: text
1687
1687
1688
1688
x is a 1-level LoDTensor:
1689
- x.lod = [[0, 2, 5, 7 ]]
1689
+ x.lod = [[2, 3, 2 ]]
1690
1690
x.data = [1, 3, 2, 4, 6, 5, 1]
1691
1691
x.dims = [7, 1]
1692
1692
1693
1693
then output is a Tensor:
1694
1694
out.dim = [3, 1]
1695
- with condition len(x.lod[-1]) - 1 == out.dims[0]
1695
+ with condition len(x.lod[-1]) == out.dims[0]
1696
1696
out.data = [1, 2, 5], where 1=first(1,3), 2=first(2,4,6), 5=first(5,1)
1697
1697
1698
1698
Args:
@@ -1719,13 +1719,13 @@ def sequence_last_step(input):
1719
1719
.. code-block:: text
1720
1720
1721
1721
x is a 1-level LoDTensor:
1722
- x.lod = [[0, 2, 5, 7 ]]
1722
+ x.lod = [[2, 3, 2 ]]
1723
1723
x.data = [1, 3, 2, 4, 6, 5, 1]
1724
1724
x.dims = [7, 1]
1725
1725
1726
1726
then output is a Tensor:
1727
1727
out.dim = [3, 1]
1728
- with condition len(x.lod[-1]) - 1 == out.dims[0]
1728
+ with condition len(x.lod[-1]) == out.dims[0]
1729
1729
out.data = [3, 6, 1], where 3=last(1,3), 6=last(2,4,6), 1=last(5,1)
1730
1730
1731
1731
Args:
@@ -2468,18 +2468,18 @@ def sequence_expand(x, y, ref_level=-1, name=None):
2468
2468
2469
2469
* Case 1
2470
2470
x is a LoDTensor:
2471
- x.lod = [[0, 2, 4 ]]
2471
+ x.lod = [[2, 2 ]]
2472
2472
x.data = [[a], [b], [c], [d]]
2473
2473
x.dims = [4, 1]
2474
2474
2475
2475
y is a LoDTensor:
2476
- y.lod = [[0, 2, 4 ],
2477
- [0 , 3, 6, 7, 8 ]]
2476
+ y.lod = [[2, 2 ],
2477
+ [3 , 3, 1, 1 ]]
2478
2478
2479
2479
ref_level: 0
2480
2480
2481
2481
then output is a 1-level LoDTensor:
2482
- out.lod = [[0, 2, 4 , 6 , 8 ]]
2482
+ out.lod = [[2, 2 , 2 , 2 ]]
2483
2483
out.data = [[a], [b], [a], [b], [c], [d], [c], [d]]
2484
2484
out.dims = [8, 1]
2485
2485
@@ -2489,7 +2489,7 @@ def sequence_expand(x, y, ref_level=-1, name=None):
2489
2489
x.dims = [3, 1]
2490
2490
2491
2491
y is a LoDTensor:
2492
- y.lod = [[0, 2, 2, 5 ]]
2492
+ y.lod = [[2, 0, 3 ]]
2493
2493
2494
2494
ref_level: -1
2495
2495
@@ -3343,15 +3343,15 @@ def ctc_greedy_decoder(input, blank, name=None):
3343
3343
[0.2, 0.2, 0.1, 0.5],
3344
3344
[0.5, 0.1, 0.3, 0.1]]
3345
3345
3346
- input.lod = [[0, 4, 8 ]]
3346
+ input.lod = [[4, 4 ]]
3347
3347
3348
3348
Then:
3349
3349
3350
3350
output.data = [[2],
3351
3351
[1],
3352
3352
[3]]
3353
3353
3354
- output.lod = [[0, 2, 3 ]]
3354
+ output.lod = [[2, 1 ]]
3355
3355
3356
3356
Args:
3357
3357
@@ -3368,7 +3368,7 @@ def ctc_greedy_decoder(input, blank, name=None):
3368
3368
3369
3369
Returns:
3370
3370
Variable: CTC greedy decode result. If all the sequences in result were
3371
- empty, the result LoDTensor will be [-1] with LoD [[0 ]] and dims [1, 1].
3371
+ empty, the result LoDTensor will be [-1] with LoD [[]] and dims [1, 1].
3372
3372
3373
3373
Examples:
3374
3374
.. code-block:: python
@@ -3458,15 +3458,15 @@ def sequence_reshape(input, new_dim):
3458
3458
.. code-block:: text
3459
3459
3460
3460
x is a LoDTensor:
3461
- x.lod = [[0, 2, 6 ]]
3461
+ x.lod = [[2, 4 ]]
3462
3462
x.data = [[1, 2], [3, 4],
3463
3463
[5, 6], [7, 8], [9, 10], [11, 12]]
3464
3464
x.dims = [6, 2]
3465
3465
3466
3466
set new_dim = 4
3467
3467
3468
3468
then out is a LoDTensor:
3469
- out.lod = [[0, 1, 3 ]]
3469
+ out.lod = [[1, 2 ]]
3470
3470
out.data = [[1, 2, 3, 4],
3471
3471
[5, 6, 7, 8], [9, 10, 11, 12]]
3472
3472
out.dims = [3, 4]
@@ -3737,7 +3737,7 @@ def im2sequence(input, filter_size=1, stride=1, padding=0, name=None):
3737
3737
3738
3738
output.dims = {8, 9}
3739
3739
3740
- output.lod = [[0, 4, 8 ]]
3740
+ output.lod = [[4, 4 ]]
3741
3741
3742
3742
The simple usage is:
3743
3743
@@ -4133,47 +4133,47 @@ def lod_reset(x, y=None, target_lod=None):
4133
4133
* Example 1:
4134
4134
4135
4135
Given a 1-level LoDTensor x:
4136
- x.lod = [[ 0 , 2, 5 6 ]]
4136
+ x.lod = [[ 2 , 3, 1 ]]
4137
4137
x.data = [[1.0], [2.0], [3.0], [4.0], [5.0], [6.0]]
4138
4138
x.dims = [6, 1]
4139
4139
4140
- target_lod: [0, 4, 6 ]
4140
+ target_lod: [4, 2 ]
4141
4141
4142
4142
then we get a 1-level LoDTensor:
4143
- out.lod = [[ 0 , 4, 6 ]]
4143
+ out.lod = [[4 , 2 ]]
4144
4144
out.data = [[1.0], [2.0], [3.0], [4.0], [5.0], [6.0]]
4145
4145
out.dims = [6, 1]
4146
4146
4147
4147
* Example 2:
4148
4148
4149
4149
Given a 1-level LoDTensor x:
4150
- x.lod = [[ 0 , 2, 5 6 ]]
4150
+ x.lod = [[2 , 3, 1 ]]
4151
4151
x.data = [[1.0], [2.0], [3.0], [4.0], [5.0], [6.0]]
4152
4152
x.dims = [6, 1]
4153
4153
4154
4154
y is a Tensor:
4155
- y.data = [[0, 2, 6 ]]
4155
+ y.data = [[2, 4 ]]
4156
4156
y.dims = [1, 3]
4157
4157
4158
4158
then we get a 1-level LoDTensor:
4159
- out.lod = [[ 0, 2, 6 ]]
4159
+ out.lod = [[2, 4 ]]
4160
4160
out.data = [[1.0], [2.0], [3.0], [4.0], [5.0], [6.0]]
4161
4161
out.dims = [6, 1]
4162
4162
4163
4163
* Example 3:
4164
4164
4165
4165
Given a 1-level LoDTensor x:
4166
- x.lod = [[ 0 , 2, 5 6 ]]
4166
+ x.lod = [[2 , 3, 1 ]]
4167
4167
x.data = [[1.0], [2.0], [3.0], [4.0], [5.0], [6.0]]
4168
4168
x.dims = [6, 1]
4169
4169
4170
4170
y is a 2-level LoDTensor:
4171
- y.lod = [[0, 2, 4 ], [0 , 2, 5, 6 ]]
4171
+ y.lod = [[2, 2 ], [2 , 2, 1, 1 ]]
4172
4172
y.data = [[1.1], [2.1], [3.1], [4.1], [5.1], [6.1]]
4173
4173
y.dims = [6, 1]
4174
4174
4175
4175
then we get a 2-level LoDTensor:
4176
- out.lod = [[0, 2, 4 ], [0 , 2, 5, 6 ]]
4176
+ out.lod = [[2, 2 ], [2 , 2, 1, 1 ]]
4177
4177
out.data = [[1.0], [2.0], [3.0], [4.0], [5.0], [6.0]]
4178
4178
out.dims = [6, 1]
4179
4179
0 commit comments