|
|
|
@ -278,6 +278,7 @@ def sequence_conv(input,
|
|
|
|
|
num_filters,
|
|
|
|
|
filter_size=3,
|
|
|
|
|
filter_stride=1,
|
|
|
|
|
act=None,
|
|
|
|
|
padding=None,
|
|
|
|
|
bias_attr=None,
|
|
|
|
|
param_attr=None,
|
|
|
|
@ -304,7 +305,7 @@ def sequence_conv(input,
|
|
|
|
|
outputs={"Out": pre_bias},
|
|
|
|
|
attrs={
|
|
|
|
|
'contextStride': filter_stride,
|
|
|
|
|
'contextStart': 0,
|
|
|
|
|
'contextStart': -int(filter_size / 2),
|
|
|
|
|
'contextLength': filter_size
|
|
|
|
|
})
|
|
|
|
|
pre_act = helper.append_bias_op(pre_bias)
|
|
|
|
@ -364,11 +365,6 @@ def conv2d(input,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sequence_pool(input, pool_type, **kwargs):
|
|
|
|
|
ENUM_POOL_TYPE = set(["MAX", "AVG", "SQRT", "LAST", "FIRST"])
|
|
|
|
|
if pool_type.upper() not in ENUM_POOL_TYPE:
|
|
|
|
|
raise ValueError("Unknown pool_type: '%s'. It can only be %s.",
|
|
|
|
|
str(pool_type), " ".join(ENUM_POOL_TYPE))
|
|
|
|
|
|
|
|
|
|
helper = LayerHelper('sequence_pool', input=input, **kwargs)
|
|
|
|
|
dtype = helper.input_dtype()
|
|
|
|
|
pool_out = helper.create_tmp_variable(dtype)
|
|
|
|
|