From b8886bf1227b52b0a06c014728076ab157e9c861 Mon Sep 17 00:00:00 2001 From: Zeng Jinle <32832641+sneaxiy@users.noreply.github.com> Date: Wed, 25 Mar 2020 00:43:33 -0500 Subject: [PATCH] rename no_need_buffer_vars_macro, test=develop (#23159) --- paddle/fluid/framework/no_need_buffer_vars_inference.h | 3 +++ .../fluid/framework/no_need_buffer_vars_inference_test.cc | 2 +- paddle/fluid/operators/argsort_op.cc | 2 +- paddle/fluid/operators/batch_size_like.h | 4 ++-- paddle/fluid/operators/center_loss_op.cc | 2 +- paddle/fluid/operators/concat_op.cc | 3 +-- paddle/fluid/operators/crop_op.cc | 2 +- paddle/fluid/operators/cvm_op.cc | 4 ++-- paddle/fluid/operators/reduce_ops/reduce_mean_op.cc | 4 ++-- paddle/fluid/operators/reduce_ops/reduce_sum_op.cc | 3 +-- paddle/fluid/operators/sequence_ops/sequence_concat_op.cc | 4 ++-- .../fluid/operators/sequence_ops/sequence_expand_as_op.cc | 6 +++--- paddle/fluid/operators/sequence_ops/sequence_expand_op.cc | 6 +++--- paddle/fluid/operators/sequence_ops/sequence_pad_op.cc | 4 ++-- paddle/fluid/operators/sequence_ops/sequence_pool_op.cc | 4 ++-- paddle/fluid/operators/sequence_ops/sequence_scatter_op.cc | 2 +- paddle/fluid/operators/sequence_ops/sequence_slice_op.cc | 4 ++-- paddle/fluid/operators/sequence_ops/sequence_softmax_op.cc | 2 +- paddle/fluid/operators/sequence_ops/sequence_unpad_op.cc | 2 +- 19 files changed, 32 insertions(+), 31 deletions(-) diff --git a/paddle/fluid/framework/no_need_buffer_vars_inference.h b/paddle/fluid/framework/no_need_buffer_vars_inference.h index 414bc899441..8ceb922c668 100644 --- a/paddle/fluid/framework/no_need_buffer_vars_inference.h +++ b/paddle/fluid/framework/no_need_buffer_vars_inference.h @@ -96,6 +96,9 @@ class NoNeedBufferVarsInference { } \ } +#define DECLARE_NO_NEED_BUFFER_VARS_INFERER \ + DECLARE_NO_NEED_BUFFER_VARS_INFERENCE + class InferNoNeedBufferVarsFN { public: inline const std::unordered_set &operator()( diff --git a/paddle/fluid/framework/no_need_buffer_vars_inference_test.cc b/paddle/fluid/framework/no_need_buffer_vars_inference_test.cc index fa826c72820..0838d43eb52 100644 --- a/paddle/fluid/framework/no_need_buffer_vars_inference_test.cc +++ b/paddle/fluid/framework/no_need_buffer_vars_inference_test.cc @@ -48,7 +48,7 @@ TEST(test_no_need_buffer_vars_inference, test_dygraph) { ASSERT_TRUE(boost::get(ctx.GetAttr("is_test"))); } -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE(TestNoNeedBufferVarsInferer, "X1", "X2"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(TestNoNeedBufferVarsInferer, "X1", "X2"); TEST(test_no_need_buffer_vars_inference, test_nullptr_comparation) { InferNoNeedBufferVarsFN infer_fn; diff --git a/paddle/fluid/operators/argsort_op.cc b/paddle/fluid/operators/argsort_op.cc index 5ea1c3f0d91..867699f32ab 100644 --- a/paddle/fluid/operators/argsort_op.cc +++ b/paddle/fluid/operators/argsort_op.cc @@ -118,7 +118,7 @@ class ArgsortGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE(ArgsortGradNoNeedBufferVarInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(ArgsortGradNoNeedBufferVarInference, "X"); } // namespace operators } // namespace paddle diff --git a/paddle/fluid/operators/batch_size_like.h b/paddle/fluid/operators/batch_size_like.h index 7e2740f148f..4a693d27de6 100644 --- a/paddle/fluid/operators/batch_size_like.h +++ b/paddle/fluid/operators/batch_size_like.h @@ -74,8 +74,8 @@ class BatchSizeLikeOpMaker : public framework::OpProtoAndCheckerMaker { virtual void Apply() = 0; }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE(BatchSizeLikeNoNeedBufferVarsInference, - "Input"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(BatchSizeLikeNoNeedBufferVarsInference, + "Input"); } // namespace operators } // namespace paddle diff --git a/paddle/fluid/operators/center_loss_op.cc b/paddle/fluid/operators/center_loss_op.cc index 4c4c678d4bf..19759519eb0 100644 --- a/paddle/fluid/operators/center_loss_op.cc +++ b/paddle/fluid/operators/center_loss_op.cc @@ -140,7 +140,7 @@ class CenterLossOpGradMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE(CenterLossGradNoNeedBufVarsInferer, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(CenterLossGradNoNeedBufVarsInferer, "X"); } // namespace operators } // namespace paddle diff --git a/paddle/fluid/operators/concat_op.cc b/paddle/fluid/operators/concat_op.cc index c639ab8b94e..9b7b3a07549 100644 --- a/paddle/fluid/operators/concat_op.cc +++ b/paddle/fluid/operators/concat_op.cc @@ -176,8 +176,7 @@ class ConcatOpGrad : public framework::OperatorWithKernel { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE(ConcatOpGradNoNeedBufferVarInference, - "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(ConcatOpGradNoNeedBufferVarInference, "X"); template class ConcatGradOpMaker : public framework::SingleGradOpMaker { diff --git a/paddle/fluid/operators/crop_op.cc b/paddle/fluid/operators/crop_op.cc index bbce75ab0c1..d0b5e510457 100644 --- a/paddle/fluid/operators/crop_op.cc +++ b/paddle/fluid/operators/crop_op.cc @@ -199,7 +199,7 @@ class CropGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE(GropNoNeedBufferVarInference, "Y"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(GropNoNeedBufferVarInference, "Y"); } // namespace operators } // namespace paddle diff --git a/paddle/fluid/operators/cvm_op.cc b/paddle/fluid/operators/cvm_op.cc index dc48f515160..e5a6a6277fe 100644 --- a/paddle/fluid/operators/cvm_op.cc +++ b/paddle/fluid/operators/cvm_op.cc @@ -141,8 +141,8 @@ class CVMGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE(CVMNoNeedBufferVarInference, "CVM"); -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE(CVMGradNoNeedBufferVarInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(CVMNoNeedBufferVarInference, "CVM"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(CVMGradNoNeedBufferVarInference, "X"); } // namespace operators } // namespace paddle diff --git a/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc b/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc index 1d6e2d52ed5..361b3b42ddb 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc @@ -82,8 +82,8 @@ class ReduceMeanDoubleGradOpBaseMaker : public imperative::GradOpBaseMakerBase { } } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE(ReduceMeanGradNoNeedBufferVarInference, - "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(ReduceMeanGradNoNeedBufferVarInference, + "X"); } // namespace operators } // namespace paddle diff --git a/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc b/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc index 4992b05b110..b4ac0714254 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc @@ -37,8 +37,7 @@ class ReduceSumOpGradMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE(ReduceSumGradNoNeedBufferVarInference, - "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(ReduceSumGradNoNeedBufferVarInference, "X"); } // namespace operators } // namespace paddle diff --git a/paddle/fluid/operators/sequence_ops/sequence_concat_op.cc b/paddle/fluid/operators/sequence_ops/sequence_concat_op.cc index bbcc18beb5e..f0fd1fc65cb 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_concat_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_concat_op.cc @@ -110,8 +110,8 @@ class SeqConcatGradOp : public framework::OperatorWithKernel { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE(SeqConcatGradNoNeedBufferVarsInference, - "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SeqConcatGradNoNeedBufferVarsInference, + "X"); } // namespace operators } // namespace paddle diff --git a/paddle/fluid/operators/sequence_ops/sequence_expand_as_op.cc b/paddle/fluid/operators/sequence_ops/sequence_expand_as_op.cc index d5526bef9d1..c93591d5ccd 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_expand_as_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_expand_as_op.cc @@ -175,9 +175,9 @@ class SequenceExpandAsOpGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE( - SequenceExpandAsOpNoNeedBufferVarsInference, "Y"); -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE( +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequenceExpandAsOpNoNeedBufferVarsInference, + "Y"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER( SequenceExpandAsGradOpNoNeedBufferVarsInference, "X", "Y"); } // namespace operators diff --git a/paddle/fluid/operators/sequence_ops/sequence_expand_op.cc b/paddle/fluid/operators/sequence_ops/sequence_expand_op.cc index c96181d3647..1000e08962c 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_expand_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_expand_op.cc @@ -230,9 +230,9 @@ class SequenceExpandOpGradMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE(SequenceExpandOpNoNeedBufferVarsInference, - "Y"); -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE( +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequenceExpandOpNoNeedBufferVarsInference, + "Y"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER( SequenceExpandGradOpNoNeedBufferVarsInference, "X", "Y"); } // namespace operators diff --git a/paddle/fluid/operators/sequence_ops/sequence_pad_op.cc b/paddle/fluid/operators/sequence_ops/sequence_pad_op.cc index 403a36e0a1f..e92fe3934cf 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_pad_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_pad_op.cc @@ -220,8 +220,8 @@ class SequencePadGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE( - SequencePadGradOpNoNeedBufferVarsInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequencePadGradOpNoNeedBufferVarsInference, + "X"); } // namespace operators } // namespace paddle diff --git a/paddle/fluid/operators/sequence_ops/sequence_pool_op.cc b/paddle/fluid/operators/sequence_ops/sequence_pool_op.cc index bcd943bc1ec..1038d15f32a 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_pool_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_pool_op.cc @@ -157,8 +157,8 @@ class SequencePoolGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE( - SequencePoolGradOpNoNeedBufferVarsInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequencePoolGradOpNoNeedBufferVarsInference, + "X"); } // namespace operators } // namespace paddle diff --git a/paddle/fluid/operators/sequence_ops/sequence_scatter_op.cc b/paddle/fluid/operators/sequence_ops/sequence_scatter_op.cc index d7ece725b44..361afa286cf 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_scatter_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_scatter_op.cc @@ -157,7 +157,7 @@ class SequenceScatterGradMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE( +DECLARE_NO_NEED_BUFFER_VARS_INFERER( SequenceScatterGradNoNeedBufferVarsInference, "Updates"); } // namespace operators diff --git a/paddle/fluid/operators/sequence_ops/sequence_slice_op.cc b/paddle/fluid/operators/sequence_ops/sequence_slice_op.cc index 1d9cf856034..0ba5108edd5 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_slice_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_slice_op.cc @@ -133,8 +133,8 @@ class SequenceSliceGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE( - SequenceSliceGradNoNeedBufferVarsInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequenceSliceGradNoNeedBufferVarsInference, + "X"); } // namespace operators } // namespace paddle diff --git a/paddle/fluid/operators/sequence_ops/sequence_softmax_op.cc b/paddle/fluid/operators/sequence_ops/sequence_softmax_op.cc index 33ad5d828b7..ec4565c3b20 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_softmax_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_softmax_op.cc @@ -151,7 +151,7 @@ class SequenceSoftmaxGradOp : public framework::OperatorWithKernel { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE( +DECLARE_NO_NEED_BUFFER_VARS_INFERER( SequenceSoftmaxGradOpNoNeedBufferVarsInferer, "X"); } // namespace operators diff --git a/paddle/fluid/operators/sequence_ops/sequence_unpad_op.cc b/paddle/fluid/operators/sequence_ops/sequence_unpad_op.cc index db6ef66d47e..e93ce7203f8 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_unpad_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_unpad_op.cc @@ -151,7 +151,7 @@ class SequenceUnpadGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERENCE( +DECLARE_NO_NEED_BUFFER_VARS_INFERER( SequenceUnpadGradOpNoNeedBufferVarsInference, "X"); } // namespace operators -- GitLab