|
|
|
@ -1329,6 +1329,8 @@ def sequence_pool(input, pool_type):
|
|
|
|
|
sqrt : out.data = [2.82, 6.93, 4.24], where 2.82=(1+3)/sqrt(2),
|
|
|
|
|
6.93=(2+4+6)/sqrt(3), 4.24=(5+1)/sqrt(2)
|
|
|
|
|
max : out.data = [3, 6, 5], where 3=max(1,3), 6=max(2,4,6), 5=max(5,1)
|
|
|
|
|
last : out.data = [3, 6, 1], where 3=last(1,3), 6=last(2,4,6), 1=last(5,1)
|
|
|
|
|
first : out.data = [1, 2, 5], where 1=first(1,3), 2=first(2,4,6), 5=first(5,1)
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
input(variable): The input variable which is a LoDTensor.
|
|
|
|
@ -1348,6 +1350,8 @@ def sequence_pool(input, pool_type):
|
|
|
|
|
sum_x = fluid.layers.sequence_pool(input=x, pool_type='sum')
|
|
|
|
|
sqrt_x = fluid.layers.sequence_pool(input=x, pool_type='sqrt')
|
|
|
|
|
max_x = fluid.layers.sequence_pool(input=x, pool_type='max')
|
|
|
|
|
last_x = fluid.layers.sequence_pool(input=x, pool_type='last')
|
|
|
|
|
first_x = fluid.layers.sequence_pool(input=x, pool_type='first')
|
|
|
|
|
"""
|
|
|
|
|
helper = LayerHelper('sequence_pool', **locals())
|
|
|
|
|
dtype = helper.input_dtype()
|
|
|
|
|