From 5453a912fe1944af68d3159e578cf8642173495e Mon Sep 17 00:00:00 2001 From: mapingshuo Date: Thu, 23 Jul 2020 10:35:21 +0800 Subject: [PATCH] add fp64 support in sequence_pool, test=develop (#25662) add fp64 support in sequence_pool, test=develop --- paddle/fluid/operators/sequence_ops/sequence_pool_op.cc | 7 +++++-- python/paddle/fluid/layers/sequence_lod.py | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/operators/sequence_ops/sequence_pool_op.cc b/paddle/fluid/operators/sequence_ops/sequence_pool_op.cc index 050ab2c9418..8a3bb5318cb 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_pool_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_pool_op.cc @@ -180,7 +180,10 @@ REGISTER_OPERATOR(sequence_pool_grad, ops::SequencePoolGradOp, ops::SequencePoolGradOpNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL( sequence_pool, - ops::SequencePoolKernel); + ops::SequencePoolKernel, + ops::SequencePoolKernel); + REGISTER_OP_CPU_KERNEL( sequence_pool_grad, - ops::SequencePoolGradKernel); + ops::SequencePoolGradKernel, + ops::SequencePoolGradKernel); diff --git a/python/paddle/fluid/layers/sequence_lod.py b/python/paddle/fluid/layers/sequence_lod.py index 969e85a7425..2d9ece63d0c 100644 --- a/python/paddle/fluid/layers/sequence_lod.py +++ b/python/paddle/fluid/layers/sequence_lod.py @@ -346,7 +346,8 @@ def sequence_pool(input, pool_type, is_test=False, pad_value=0.0): """ assert not in_dygraph_mode(), ( "sequence layer is not supported in dygraph mode yet.") - check_variable_and_dtype(input, 'input', ['float32'], 'sequence_pool') + check_variable_and_dtype(input, 'input', ['float32', 'float64'], + 'sequence_pool') helper = LayerHelper('sequence_pool', **locals()) dtype = helper.input_dtype() pool_out = helper.create_variable_for_type_inference(dtype) -- GitLab