diff --git a/paddle/fluid/operators/math/sequence_pooling.cc b/paddle/fluid/operators/math/sequence_pooling.cc index f531cc058bf0f0736b0f80f3a9dfb3c18842fd8a..69318a6598c8c69eceab7216df6382537153d34f 100644 --- a/paddle/fluid/operators/math/sequence_pooling.cc +++ b/paddle/fluid/operators/math/sequence_pooling.cc @@ -107,7 +107,8 @@ template class LastSeqPoolFunctor { public: void operator()(const platform::CPUDeviceContext& context, - const framework::LoDTensor& input, framework::Tensor* output) { + const framework::LoDTensor& input, + framework::Tensor* output) { // Create pointers to input and output data auto* in_data = input.data(); auto* out_data = output->data(); @@ -124,7 +125,7 @@ class LastSeqPoolFunctor { // Copy the last item of sequence to output std::memcpy(out_data, (in_data - item_size), item_size * sizeof(T)); out_data += item_size; - } + } } }; @@ -132,7 +133,8 @@ template class FirstSeqPoolFunctor { public: void operator()(const platform::CPUDeviceContext& context, - const framework::LoDTensor& input, framework::Tensor* output) { + const framework::LoDTensor& input, + framework::Tensor* output) { // Create pointers to input and output data auto* in_data = input.data(); auto* out_data = output->data(); @@ -149,7 +151,7 @@ class FirstSeqPoolFunctor { // Point to the next sequence in_data += seq_len * item_size; out_data += item_size; - } + } } }; @@ -176,8 +178,6 @@ class SequencePoolFunctor { first_pool(context, input, output); return; } - - auto lod = input.lod()[0]; auto& place = *context.eigen_device(); for (int i = 0; i < static_cast(lod.size()) - 1; ++i) {