diff --git a/CMakeLists.txt b/CMakeLists.txt index d79f3458867604313577649da04297a28ce1a3c1..127df949dd7bf2457170b8cdd9bc8e7e449273d2 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,7 +88,7 @@ option(WITH_DGC "Use DGC(Deep Gradient Compression) or not" ${WITH_DISTRIBUTE} option(SANITIZER_TYPE "Choose the type of sanitizer, options are: Address, Leak, Memory, Thread, Undefined" OFF) option(WITH_LITE "Compile Paddle Fluid with Lite Engine" OFF) option(WITH_NCCL "Compile PaddlePaddle with NCCL support" ON) -option(WITH_CRYPTO "Compile PaddlePaddle with crypto support" ON) +option(WITH_CRYPTO "Compile PaddlePaddle with paddle_crypto lib" ON) # PY_VERSION if(NOT PY_VERSION) diff --git a/paddle/fluid/framework/CMakeLists.txt b/paddle/fluid/framework/CMakeLists.txt index 95a261be1a70131dd1282c2ce1f027c52a41c5ce..2e5e09251aaa733b079f24e2b8dd421dc94394e6 100644 --- a/paddle/fluid/framework/CMakeLists.txt +++ b/paddle/fluid/framework/CMakeLists.txt @@ -148,6 +148,7 @@ cc_library(proto_desc SRCS var_desc.cc op_desc.cc block_desc.cc program_desc.cc cc_library(op_registry SRCS op_registry.cc DEPS op_proto_maker op_info operator glog proto_desc) cc_library(op_call_stack SRCS op_call_stack.cc DEPS op_proto_maker enforce) +cc_test(op_call_stack_test SRCS op_call_stack_test.cc DEPS op_call_stack) nv_test(op_registry_test SRCS op_registry_test.cc DEPS op_registry) diff --git a/paddle/fluid/framework/grad_op_desc_maker.h b/paddle/fluid/framework/grad_op_desc_maker.h index 368e4c1f90f15792bd030f5430eb742e3b41ec28..7a3ba0863cf20d69a37d515dd17089c9f46cca26 100644 --- a/paddle/fluid/framework/grad_op_desc_maker.h +++ b/paddle/fluid/framework/grad_op_desc_maker.h @@ -18,7 +18,9 @@ limitations under the License. */ #include #include #include +#include #include +#include "paddle/fluid/framework/op_call_stack.h" #include "paddle/fluid/framework/op_desc.h" #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/imperative/dygraph_grad_maker.h" @@ -195,7 +197,14 @@ class SingleGradOpMaker : public GradOpDescMakerBase { std::vector> operator()() const final { std::vector> retv; retv.emplace_back(new OpDesc()); - this->Apply(retv.front().get()); + try { + this->Apply(retv.front().get()); + } catch (platform::EnforceNotMet& exception) { + framework::AppendErrorOpHint(retv.front().get()->Type(), &exception); + throw std::move(exception); + } catch (...) { + std::rethrow_exception(std::current_exception()); + } return retv; } @@ -213,7 +222,14 @@ class SingleGradOpMaker auto node = this->NewGradNode(); { imperative::TracedGradOp traced_grad_op(node); - this->Apply(&traced_grad_op); + try { + this->Apply(&traced_grad_op); + } catch (platform::EnforceNotMet& exception) { + framework::AppendErrorOpHint(traced_grad_op.Type(), &exception); + throw std::move(exception); + } catch (...) { + std::rethrow_exception(std::current_exception()); + } } return node->empty() ? nullptr : node; } diff --git a/paddle/fluid/framework/op_call_stack.cc b/paddle/fluid/framework/op_call_stack.cc index fdbcf74d64b2423c4cdaa29cd1b0cacbc7ad0869..3a9b113ceac573c831ce39993d7e2f6df37ee5fe 100644 --- a/paddle/fluid/framework/op_call_stack.cc +++ b/paddle/fluid/framework/op_call_stack.cc @@ -56,9 +56,15 @@ void InsertCallStackInfo(const std::string &type, const AttributeMap &attrs, } // Step 3. Construct final call stack & append error op name sout << exception->err_str_; - if (callstack) { - sout << " [operator < " << type << " > error]"; - } + sout << " [operator < " << type << " > error]"; + exception->err_str_ = sout.str(); +} + +void AppendErrorOpHint(const std::string &type, + platform::EnforceNotMet *exception) { + std::ostringstream sout; + sout << exception->err_str_; + sout << " [operator < " << type << " > error]"; exception->err_str_ = sout.str(); } diff --git a/paddle/fluid/framework/op_call_stack.h b/paddle/fluid/framework/op_call_stack.h index 4408601abf0b3542c9850f9264d162faaa6a50ce..d48cf27285a0a5040b5e375a27ccf6a8b00bd8c0 100644 --- a/paddle/fluid/framework/op_call_stack.h +++ b/paddle/fluid/framework/op_call_stack.h @@ -20,7 +20,14 @@ limitations under the License. */ namespace paddle { namespace framework { + +// insert python call stack & append error op for exception message void InsertCallStackInfo(const std::string &type, const AttributeMap &attrs, platform::EnforceNotMet *exception); + +// only append error op for exception message +void AppendErrorOpHint(const std::string &type, + platform::EnforceNotMet *exception); + } // namespace framework } // namespace paddle diff --git a/paddle/fluid/framework/op_call_stack_test.cc b/paddle/fluid/framework/op_call_stack_test.cc new file mode 100644 index 0000000000000000000000000000000000000000..93db97a93f4ca0182cdfc996015637565eb2e35e --- /dev/null +++ b/paddle/fluid/framework/op_call_stack_test.cc @@ -0,0 +1,61 @@ +/* Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. */ + +#include "paddle/fluid/framework/op_call_stack.h" + +#include +#include + +#include "gtest/gtest.h" + +namespace paddle { +namespace framework { +namespace details { + +static void ThrowEnforceNotMet() { + PADDLE_THROW(platform::errors::InvalidArgument( + "\n----------------------\nError Message " + "Summary:\n----------------------\n" + "Created error.")); +} + +} // namespace details +} // namespace framework +} // namespace paddle + +TEST(OpCallStack, InsertCallStackInfo) { + try { + paddle::framework::details::ThrowEnforceNotMet(); + } catch (paddle::platform::EnforceNotMet &exception) { + paddle::framework::AttributeMap attr_map; + std::string stack_test_str = "test for op callstack"; + std::vector stack_test_vec; + stack_test_vec.emplace_back(stack_test_str); + attr_map["op_callstack"] = stack_test_vec; + paddle::framework::InsertCallStackInfo("test", attr_map, &exception); + std::string ex_msg = exception.what(); + EXPECT_TRUE(ex_msg.find(stack_test_str) != std::string::npos); + EXPECT_TRUE(ex_msg.find("[operator < test > error]") != std::string::npos); + } +} + +TEST(OpCallStack, AppendErrorOpHint) { + try { + paddle::framework::details::ThrowEnforceNotMet(); + } catch (paddle::platform::EnforceNotMet &exception) { + paddle::framework::AppendErrorOpHint("test", &exception); + std::string ex_msg = exception.what(); + EXPECT_TRUE(ex_msg.find("[operator < test > error]") != std::string::npos); + } +} diff --git a/paddle/fluid/imperative/dygraph_grad_maker.h b/paddle/fluid/imperative/dygraph_grad_maker.h index a7bb47d40d5f1a4bc9b3ee355cd239d7255c7e73..f21781fbbecfb4b168c6a0ec0276707fbe7ddec1 100644 --- a/paddle/fluid/imperative/dygraph_grad_maker.h +++ b/paddle/fluid/imperative/dygraph_grad_maker.h @@ -258,6 +258,8 @@ class TracedGradOp { } } + std::string Type() const { return op_->Type(); } + void SetType(const std::string& type) { op_->SetType(type); } void SetAttrMap(const framework::AttributeMap& attrs) { diff --git a/paddle/fluid/inference/tensorrt/convert/hard_sigmoid_op.cc b/paddle/fluid/inference/tensorrt/convert/hard_sigmoid_op.cc index 529c845a12a7d95b558ded7ec4d80e3624ee1b79..3b6e464a117d3eedb4848dcaaf5c06fdb453fac1 100644 --- a/paddle/fluid/inference/tensorrt/convert/hard_sigmoid_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/hard_sigmoid_op.cc @@ -25,7 +25,7 @@ class HardSigmoidOpConverter : public OpConverter { public: void operator()(const framework::proto::OpDesc& op, const framework::Scope& scope, bool test_mode) override { -#if IS_TRT_VERSION_GE(5000) +#if IS_TRT_VERSION_GE(5130) VLOG(3) << "convert a fluid HardSigmoid op to tensorrt IActivationLayer " "layer without bias"; framework::OpDesc op_desc(op, nullptr); diff --git a/paddle/fluid/operators/activation_op.cc b/paddle/fluid/operators/activation_op.cc index fd5f7e06b1b3c6a183083f38a05601551bb11d48..59055a8679c14992e8356de06ae56ce621d0aba8 100644 --- a/paddle/fluid/operators/activation_op.cc +++ b/paddle/fluid/operators/activation_op.cc @@ -822,10 +822,10 @@ class SquareDoubleGradMaker : public ::paddle::framework::SingleGradOpMaker { } }; -DECLARE_INPLACE_OP_INFERER(ActivationGradOpInplaceInference, +DECLARE_INPLACE_OP_INFERER(ActivationGradOpInplaceInferer, {framework::GradVarName("Out"), framework::GradVarName("X")}); -DECLARE_INPLACE_OP_INFERER(ActivationDoubleGradOpInplaceInference, +DECLARE_INPLACE_OP_INFERER(ActivationDoubleGradOpInplaceInferer, {"DDX", "DDOut"}); template @@ -913,7 +913,7 @@ namespace plat = paddle::platform; std::conditional>(), \ ops::ActFwdInplaceInferer, void>::type); \ REGISTER_OPERATOR(KERNEL_TYPE##_grad, ops::ActivationOpGrad, \ - ops::ActivationGradOpInplaceInference); + ops::ActivationGradOpInplaceInferer); #define REGISTER_ACTIVATION_CPU_KERNEL(act_type, op_name, functor, \ grad_functor) \ @@ -941,13 +941,13 @@ REGISTER_OPERATOR( paddle::imperative::OpBase>, ops::ActFwdInplaceInferer); REGISTER_OPERATOR(relu_grad, ops::ActivationOpGrad, - ops::ActivationGradOpInplaceInference, + ops::ActivationGradOpInplaceInferer, ops::ReluDoubleGradMaker, ops::ReluDoubleGradMaker); REGISTER_OPERATOR( relu_grad_grad, ops::ActivationOpDoubleGrad2::FwdDeps()>, - ops::ActivationDoubleGradOpInplaceInference); + ops::ActivationDoubleGradOpInplaceInferer); REGISTER_ACTIVATION_CPU_KERNEL(relu, Relu, ReluFunctor, ReluGradFunctor); @@ -971,13 +971,13 @@ REGISTER_OPERATOR( paddle::imperative::OpBase>, ops::ActFwdInplaceInferer); REGISTER_OPERATOR(leaky_relu_grad, ops::ActivationOpGrad, - ops::ActivationGradOpInplaceInference, + ops::ActivationGradOpInplaceInferer, ops::LeakyReluDoubleGradMaker, ops::LeakyReluDoubleGradMaker); REGISTER_OPERATOR( leaky_relu_grad_grad, ops::ActivationOpDoubleGrad2::FwdDeps()>, - ops::ActivationDoubleGradOpInplaceInference); + ops::ActivationDoubleGradOpInplaceInferer); REGISTER_ACTIVATION_CPU_KERNEL(leaky_relu, LeakyRelu, LeakyReluFunctor, LeakyReluGradFunctor); @@ -1000,13 +1000,13 @@ REGISTER_OPERATOR( paddle::imperative::OpBase>, ops::ActFwdInplaceInferer); REGISTER_OPERATOR(elu_grad, ops::ActivationOpGrad, - ops::ActivationGradOpInplaceInference, + ops::ActivationGradOpInplaceInferer, ops::ELUDoubleGradMaker, ops::ELUDoubleGradMaker); REGISTER_OPERATOR( elu_grad_grad, ops::ActivationOpDoubleGrad::FwdDeps()>, - ops::ActivationDoubleGradOpInplaceInference); + ops::ActivationDoubleGradOpInplaceInferer); REGISTER_ACTIVATION_CPU_KERNEL(elu, ELU, ELUFunctor, ELUGradFunctor); REGISTER_OP_CPU_KERNEL( @@ -1028,13 +1028,13 @@ REGISTER_OPERATOR( paddle::imperative::OpBase>, ops::ActFwdInplaceInferer); REGISTER_OPERATOR(sqrt_grad, ops::ActivationOpGrad, - ops::ActivationGradOpInplaceInference, + ops::ActivationGradOpInplaceInferer, ops::SqrtDoubleGradMaker, ops::SqrtDoubleGradMaker); REGISTER_OPERATOR( sqrt_grad_grad, ops::ActivationOpDoubleGrad::FwdDeps()>, - ops::ActivationDoubleGradOpInplaceInference); + ops::ActivationDoubleGradOpInplaceInferer); REGISTER_ACTIVATION_CPU_KERNEL(sqrt, Sqrt, SqrtFunctor, SqrtGradFunctor); REGISTER_OP_CPU_KERNEL( @@ -1056,13 +1056,13 @@ REGISTER_OPERATOR( paddle::imperative::OpBase>, ops::ActFwdInplaceInferer); REGISTER_OPERATOR(square_grad, ops::ActivationOpGrad, - ops::ActivationGradOpInplaceInference, + ops::ActivationGradOpInplaceInferer, ops::SquareDoubleGradMaker, ops::SquareDoubleGradMaker); REGISTER_OPERATOR( square_grad_grad, ops::ActivationOpDoubleGrad::FwdDeps()>, - ops::ActivationDoubleGradOpInplaceInference); + ops::ActivationDoubleGradOpInplaceInferer); REGISTER_OP_CPU_KERNEL(square, ops::ActivationKernel>(), ops::ActFwdInplaceInferer, void>::type); REGISTER_OPERATOR(pow_grad, ops::PowOpGrad, - ops::ActivationGradOpInplaceInference); + ops::ActivationGradOpInplaceInferer); REGISTER_OP_CPU_KERNEL( pow, ops::PowKernel>, @@ -1131,7 +1131,7 @@ REGISTER_OPERATOR( std::conditional>(), ops::ActFwdInplaceInferer, void>::type); REGISTER_OPERATOR(exp_grad, ops::ActivationOpGrad, - ops::ActivationGradOpInplaceInference); + ops::ActivationGradOpInplaceInferer); REGISTER_OP_CPU_KERNEL(exp, ops::ActivationKernel>(), ops::ActFwdInplaceInferer, void>::type); REGISTER_OPERATOR(abs_grad, ops::ActivationOpGrad, - ops::ActivationGradOpInplaceInference); + ops::ActivationGradOpInplaceInferer); REGISTER_OP_CPU_KERNEL(abs, ops::ActivationKernel { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(ArgsortGradNoNeedBufferVarInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(ArgsortGradNoNeedBufferVarsInferer, "X"); } // namespace operators } // namespace paddle @@ -126,7 +126,7 @@ REGISTER_OPERATOR(argsort, ops::ArgsortOp, ops::ArgsortOpMaker, ops::ArgsortGradOpMaker, ops::ArgsortGradOpMaker); REGISTER_OPERATOR(argsort_grad, ops::ArgsortGradOp, - ops::ArgsortGradNoNeedBufferVarInference); + ops::ArgsortGradNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL(argsort, ops::ArgsortKernel, ops::ArgsortKernel, diff --git a/paddle/fluid/operators/batch_fc_op.cc b/paddle/fluid/operators/batch_fc_op.cc index 004ebe0eb81fceeb95774e86dd918bceb7ec7b98..952625bcb6e46e33db4658d5257bf6359b7c1174 100644 --- a/paddle/fluid/operators/batch_fc_op.cc +++ b/paddle/fluid/operators/batch_fc_op.cc @@ -136,7 +136,7 @@ class BatchFCGradOpMaker : public framework::SingleGradOpMaker { op->SetAttrMap(this->Attrs()); } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(BatchFCGradOpNoNeedBufferVarsInference, +DECLARE_NO_NEED_BUFFER_VARS_INFERER(BatchFCGradOpNoNeedBufferVarsInferer, "Bias"); } // namespace operators @@ -148,7 +148,7 @@ REGISTER_OPERATOR(batch_fc, ops::BatchFCOp, ops::BatchFCOpMaker, ops::BatchFCGradOpMaker); REGISTER_OPERATOR(batch_fc_grad, ops::BatchFCGradOp, - ops::BatchFCGradOpNoNeedBufferVarsInference); + ops::BatchFCGradOpNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL( batch_fc, ops::BatchFCKernel, diff --git a/paddle/fluid/operators/batch_size_like.h b/paddle/fluid/operators/batch_size_like.h index 4a693d27de6483cce03396b05aab7d9a519b34cf..d2cf38049300578eb1626d39c0959b9beed13cdd 100644 --- a/paddle/fluid/operators/batch_size_like.h +++ b/paddle/fluid/operators/batch_size_like.h @@ -74,7 +74,7 @@ class BatchSizeLikeOpMaker : public framework::OpProtoAndCheckerMaker { virtual void Apply() = 0; }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(BatchSizeLikeNoNeedBufferVarsInference, +DECLARE_NO_NEED_BUFFER_VARS_INFERER(BatchSizeLikeNoNeedBufferVarsInferer, "Input"); } // namespace operators diff --git a/paddle/fluid/operators/concat_op.cc b/paddle/fluid/operators/concat_op.cc index e4ef952b7bdf99bdad1d60830f241d1a3b56689d..49fb1c6e17d0c68d1be3abe1f2e850ac2dc5b850 100644 --- a/paddle/fluid/operators/concat_op.cc +++ b/paddle/fluid/operators/concat_op.cc @@ -175,7 +175,7 @@ class ConcatOpGrad : public framework::OperatorWithKernel { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(ConcatOpGradNoNeedBufferVarInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(ConcatOpGradNoNeedBufferVarInferer, "X"); template class ConcatGradOpMaker : public framework::SingleGradOpMaker { @@ -203,7 +203,7 @@ REGISTER_OPERATOR(concat, ops::ConcatOp, ops::ConcatOpMaker, ops::ConcatGradOpMaker, ops::ConcatGradOpMaker); REGISTER_OPERATOR(concat_grad, ops::ConcatOpGrad, - ops::ConcatOpGradNoNeedBufferVarInference); + ops::ConcatOpGradNoNeedBufferVarInferer); REGISTER_OP_CPU_KERNEL( concat, ops::ConcatKernel, ops::ConcatKernel, diff --git a/paddle/fluid/operators/conv_cudnn_helper.h b/paddle/fluid/operators/conv_cudnn_helper.h index d20311d091ce48311693656f7b741ea769ef91db..fadffaee71d21e736bcc0ab696e44277a85345eb 100644 --- a/paddle/fluid/operators/conv_cudnn_helper.h +++ b/paddle/fluid/operators/conv_cudnn_helper.h @@ -148,7 +148,7 @@ struct SearchAlgorithm { } #endif - if (!exhaustive) { + if (!exhaustive && !deterministic) { #if CUDNN_VERSION >= 7001 int perf_count; int best_algo_idx = 0; @@ -185,6 +185,8 @@ struct SearchAlgorithm { workspace_size_limit, &algo)); #endif VLOG(3) << "choose algo " << algo; + } else if (deterministic) { + algo = static_cast(1); } else { auto& dev_ctx = ctx.template device_context(); diff --git a/paddle/fluid/operators/conv_transpose_cudnn_op.cu b/paddle/fluid/operators/conv_transpose_cudnn_op.cu index a515b153581f2cb9585ce39ceeda91d88b2ad334..99ec1e048101b281e71005f6fde328c664ba66be 100644 --- a/paddle/fluid/operators/conv_transpose_cudnn_op.cu +++ b/paddle/fluid/operators/conv_transpose_cudnn_op.cu @@ -245,7 +245,8 @@ class CUDNNConvTransposeOpKernel : public framework::OpKernel { int output_offset = transformed_output.numel() / transformed_output.dims()[0] / groups; int filter_offset = filter->numel() / groups; - T alpha = static_cast(1.0), beta = static_cast(0.0); + ScalingParamType alpha = 1.0f; + ScalingParamType beta = 0.0f; auto workspace_handle = dev_ctx.cudnn_workspace_handle(); for (int g = 0; g < groups; g++) { auto cudnn_func = [&](void* cudnn_workspace) { @@ -493,7 +494,8 @@ class CUDNNConvTransposeGradOpKernel : public framework::OpKernel { int output_grad_offset = transformed_output_grad.numel() / transformed_output_grad.dims()[0] / groups; int filter_offset = filter->numel() / groups; - T alpha = static_cast(1.0), beta = static_cast(0.0); + ScalingParamType alpha = 1.0f; + ScalingParamType beta = 0.0f; auto workspace_handle = dev_ctx.cudnn_workspace_handle(); if (input_grad) { // Because beta is zero, it is unnecessary to reset input_grad. diff --git a/paddle/fluid/operators/crop_op.cc b/paddle/fluid/operators/crop_op.cc index c73b421ae4feb7c386729b0bed11c597e0cb3ffb..2031ed14242a1a2b4a441bf171bfeb31790506a3 100644 --- a/paddle/fluid/operators/crop_op.cc +++ b/paddle/fluid/operators/crop_op.cc @@ -203,7 +203,7 @@ class CropGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(GropNoNeedBufferVarInference, "Y"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(GropNoNeedBufferVarInferer, "Y"); } // namespace operators } // namespace paddle @@ -212,7 +212,7 @@ namespace ops = paddle::operators; REGISTER_OPERATOR(crop, ops::CropOp, ops::CropOpMaker, ops::CropGradOpMaker, ops::CropGradOpMaker, - ops::GropNoNeedBufferVarInference); + ops::GropNoNeedBufferVarInferer); REGISTER_OPERATOR(crop_grad, ops::CropOpGrad); REGISTER_OP_CPU_KERNEL( crop, ops::CropKernel, diff --git a/paddle/fluid/operators/cvm_op.cc b/paddle/fluid/operators/cvm_op.cc index 155f8f518f9046e53659a348fbc202f80586cddb..995ff4a9c72e4f702eb1029cead75533dcf96d3d 100644 --- a/paddle/fluid/operators/cvm_op.cc +++ b/paddle/fluid/operators/cvm_op.cc @@ -153,8 +153,8 @@ class CVMGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(CVMNoNeedBufferVarInference, "CVM"); -DECLARE_NO_NEED_BUFFER_VARS_INFERER(CVMGradNoNeedBufferVarInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(CVMNoNeedBufferVarInferer, "CVM"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(CVMGradNoNeedBufferVarInferer, "X"); } // namespace operators } // namespace paddle @@ -163,10 +163,10 @@ namespace ops = paddle::operators; REGISTER_OPERATOR(cvm, ops::CVMOp, ops::CVMOpMaker, ops::CVMGradOpMaker, ops::CVMGradOpMaker, - ops::CVMNoNeedBufferVarInference); + ops::CVMNoNeedBufferVarInferer); REGISTER_OPERATOR(cvm_grad, ops::CVMGradientOp, - ops::CVMGradNoNeedBufferVarInference); + ops::CVMGradNoNeedBufferVarInferer); REGISTER_OP_CPU_KERNEL(cvm, ops::CVMOpKernel, ops::CVMOpKernel); diff --git a/paddle/fluid/operators/elementwise/elementwise_add_op.cc b/paddle/fluid/operators/elementwise/elementwise_add_op.cc index a12fd01e82b19fdfda7570ae7027372bdb52818f..534a19bd94a231f0522dd15d2510917be8c71a4b 100644 --- a/paddle/fluid/operators/elementwise/elementwise_add_op.cc +++ b/paddle/fluid/operators/elementwise/elementwise_add_op.cc @@ -97,15 +97,15 @@ REGISTER_ELEMWISE_EXPLICIT_OP_WITHOUT_GRAD(elementwise_add, Add); namespace ops = paddle::operators; REGISTER_OPERATOR( - elementwise_add_grad, ops::ElementwiseOpGrad, ops::ElementwiseGradOpInplace, - ops::ElementwiseGradNoBufVarsInference, + elementwise_add_grad, ops::ElementwiseOpGrad, + ops::ElementwiseGradOpInplaceInferer, ops::ElementwiseGradNoBufVarsInferer, ops::ElementwiseAddDoubleGradMaker, ops::ElementwiseAddDoubleGradMaker); REGISTER_OPERATOR(elementwise_add_grad_grad, ops::ElementwiseOpDoubleGradWithoutDXDY, - ops::ElementwiseDoubleGradOpInplace, - ops::ElementwiseDoubleGradNoBufVarsInference); + ops::ElementwiseDoubleGradOpInplaceInferer, + ops::ElementwiseDoubleGradNoBufVarsInferer); REGISTER_OP_CPU_KERNEL( elementwise_add, diff --git a/paddle/fluid/operators/elementwise/elementwise_div_op.cc b/paddle/fluid/operators/elementwise/elementwise_div_op.cc index b603bd924a928401392c36328ddb03f366061744..49d7158f4c67ca9beb68a4b6bce1f47b4352dc81 100644 --- a/paddle/fluid/operators/elementwise/elementwise_div_op.cc +++ b/paddle/fluid/operators/elementwise/elementwise_div_op.cc @@ -123,7 +123,7 @@ REGISTER_OPERATOR( ops::ElementwiseDivDoubleGradMaker); REGISTER_OPERATOR(elementwise_div_grad_grad, ops::ElementwiseDivOpDoubleGrad, - ops::ElementwiseDoubleGradOpInplace); + ops::ElementwiseDoubleGradOpInplaceInferer); REGISTER_OP_CPU_KERNEL( elementwise_div, diff --git a/paddle/fluid/operators/elementwise/elementwise_mul_op.cc b/paddle/fluid/operators/elementwise/elementwise_mul_op.cc index bedd808b847c53fc8197045c282c21b65f9a382b..289ea6c2263873d9a5a8b6c1cd79ab20197f00a4 100644 --- a/paddle/fluid/operators/elementwise/elementwise_mul_op.cc +++ b/paddle/fluid/operators/elementwise/elementwise_mul_op.cc @@ -123,7 +123,7 @@ REGISTER_OPERATOR( ops::ElementwiseMulDoubleGradMaker); REGISTER_OPERATOR(elementwise_mul_grad_grad, ops::ElementwiseOpDoubleGrad, - ops::ElementwiseDoubleGradOpInplace); + ops::ElementwiseDoubleGradOpInplaceInferer); REGISTER_OP_CPU_KERNEL( elementwise_mul, diff --git a/paddle/fluid/operators/elementwise/elementwise_op.h b/paddle/fluid/operators/elementwise/elementwise_op.h index 85d501f6bf7f8f856040c120d49a73a4f4d6696d..c24b5c0208de69f25a77af3556a4830ca237a7c0 100644 --- a/paddle/fluid/operators/elementwise/elementwise_op.h +++ b/paddle/fluid/operators/elementwise/elementwise_op.h @@ -348,16 +348,16 @@ class ElemwiseGradKernel : public framework::OpKernel { } }; -DECLARE_INPLACE_OP_INFERER(ElementwiseOpInplace, {"X", "Out"}); -DECLARE_INPLACE_OP_INFERER(ElementwiseGradOpInplace, +DECLARE_INPLACE_OP_INFERER(ElementwiseOpInplaceInferer, {"X", "Out"}); +DECLARE_INPLACE_OP_INFERER(ElementwiseGradOpInplaceInferer, {framework::GradVarName("Out"), framework::GradVarName("X")}); -DECLARE_INPLACE_OP_INFERER(ElementwiseDoubleGradOpInplace, {"DDX", "DDOut"}); +DECLARE_INPLACE_OP_INFERER(ElementwiseDoubleGradOpInplaceInferer, + {"DDX", "DDOut"}); -DECLARE_NO_NEED_BUFFER_VARS_INFERER(ElementwiseGradNoBufVarsInference, "X", - "Y"); -DECLARE_NO_NEED_BUFFER_VARS_INFERER(ElementwiseDoubleGradNoBufVarsInference, - "Y", "DOut"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(ElementwiseGradNoBufVarsInferer, "X", "Y"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(ElementwiseDoubleGradNoBufVarsInferer, "Y", + "DOut"); } // namespace operators } // namespace paddle @@ -389,4 +389,4 @@ DECLARE_NO_NEED_BUFFER_VARS_INFERER(ElementwiseDoubleGradNoBufVarsInference, ::paddle::operators::ElementwiseOpInferVarType, \ op_type##GradMaker<::paddle::framework::OpDesc>, \ op_type##GradMaker<::paddle::imperative::OpBase>, \ - ::paddle::operators::ElementwiseOpInplace); + ::paddle::operators::ElementwiseOpInplaceInferer); diff --git a/paddle/fluid/operators/elementwise/elementwise_sub_op.cc b/paddle/fluid/operators/elementwise/elementwise_sub_op.cc index a2ccd254c9ad647950711d23652b49baa3a77cb6..9603b022d5d8c4672219b7199d1bfe4fb6bfe3e9 100644 --- a/paddle/fluid/operators/elementwise/elementwise_sub_op.cc +++ b/paddle/fluid/operators/elementwise/elementwise_sub_op.cc @@ -97,14 +97,14 @@ REGISTER_ELEMWISE_EXPLICIT_OP_WITHOUT_GRAD(elementwise_sub, Sub); namespace ops = paddle::operators; REGISTER_OPERATOR( - elementwise_sub_grad, ops::ElementwiseOpGrad, ops::ElementwiseGradOpInplace, - ops::ElementwiseGradNoBufVarsInference, + elementwise_sub_grad, ops::ElementwiseOpGrad, + ops::ElementwiseGradOpInplaceInferer, ops::ElementwiseGradNoBufVarsInferer, ops::ElementwiseSubDoubleGradMaker, ops::ElementwiseSubDoubleGradMaker); REGISTER_OPERATOR(elementwise_sub_grad_grad, ops::ElementwiseOpDoubleGradWithoutDXDY, - ops::ElementwiseDoubleGradOpInplace, - ops::ElementwiseDoubleGradNoBufVarsInference); + ops::ElementwiseDoubleGradOpInplaceInferer, + ops::ElementwiseDoubleGradNoBufVarsInferer); REGISTER_OP_CPU_KERNEL( elementwise_sub, diff --git a/paddle/fluid/operators/fill_constant_batch_size_like_op.cc b/paddle/fluid/operators/fill_constant_batch_size_like_op.cc index ccd4a3628783780c5b8cd76c97c54dcac49539e5..f699dac7976c5aa6745ca5d08079699e3cc0a63c 100644 --- a/paddle/fluid/operators/fill_constant_batch_size_like_op.cc +++ b/paddle/fluid/operators/fill_constant_batch_size_like_op.cc @@ -63,7 +63,7 @@ REGISTER_OPERATOR( paddle::framework::EmptyGradOpMaker, paddle::framework::EmptyGradOpMaker, ops::FillConstantBatchSizeLikeOpMaker, - ops::BatchSizeLikeNoNeedBufferVarsInference); + ops::BatchSizeLikeNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL( fill_constant_batch_size_like, ops::FillConstantBatchSizeLikeOpKernel, paddle::framework::EmptyGradOpMaker); diff --git a/paddle/fluid/operators/flatten_op.cc b/paddle/fluid/operators/flatten_op.cc index 067e00f35bc4605ce004744a276a9588cb9e425d..aff5f49c73bdce9a5899ed8be17419b8301d52c0 100644 --- a/paddle/fluid/operators/flatten_op.cc +++ b/paddle/fluid/operators/flatten_op.cc @@ -241,11 +241,11 @@ class Flatten2GradOp : public framework::OperatorWithKernel { } }; -DECLARE_INPLACE_OP_INFERER(FlattenOpInplaceInToOut, {"X", "Out"}); -DECLARE_INPLACE_OP_INFERER(FlattenGradInplaceinToOut, +DECLARE_INPLACE_OP_INFERER(FlattenOpInplaceInferer, {"X", "Out"}); +DECLARE_INPLACE_OP_INFERER(FlattenGradInplaceInferer, {framework::GradVarName("Out"), framework::GradVarName("X")}); -DECLARE_NO_NEED_BUFFER_VARS_INFERER(FlattenGradNoNeedBufferVarsInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(FlattenGradNoNeedBufferVarsInferer, "X"); } // namespace operators } // namespace paddle @@ -254,17 +254,17 @@ namespace ops = paddle::operators; REGISTER_OPERATOR(flatten, ops::FlattenOp, ops::FlattenOpMaker, ops::FlattenGradOpMaker, ops::FlattenGradOpMaker, - ops::FlattenOpInplaceInToOut); + ops::FlattenOpInplaceInferer); REGISTER_OPERATOR(flatten_grad, ops::FlattenGradOp, - ops::FlattenGradInplaceinToOut, - ops::FlattenGradNoNeedBufferVarsInference); + ops::FlattenGradInplaceInferer, + ops::FlattenGradNoNeedBufferVarsInferer); REGISTER_OPERATOR(flatten2, ops::Flatten2Op, ops::Flatten2OpMaker, ops::Flatten2GradOpMaker, ops::Flatten2GradOpMaker, - ops::FlattenOpInplaceInToOut); + ops::FlattenOpInplaceInferer); REGISTER_OPERATOR(flatten2_grad, ops::Flatten2GradOp, - ops::FlattenGradInplaceinToOut); + ops::FlattenGradInplaceInferer); REGISTER_OP_CPU_KERNEL( flatten, ops::FlattenKernel, diff --git a/paddle/fluid/operators/gather_nd_op.cc b/paddle/fluid/operators/gather_nd_op.cc index e058564b426c8bd4d96dd3ce778b59b407d99636..c22c8a18ca63a05265ac6991cf0e0cbd9e7ea5ed 100644 --- a/paddle/fluid/operators/gather_nd_op.cc +++ b/paddle/fluid/operators/gather_nd_op.cc @@ -166,7 +166,7 @@ class GatherNdGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(GatherNdGradNoNeedBufferVarInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(GatherNdGradNoNeedBufferVarInferer, "X"); } // namespace operators } // namespace paddle @@ -178,7 +178,7 @@ REGISTER_OPERATOR(gather_nd, ops::GatherNdOp, ops::GatherNdOpMaker, ops::GatherNdGradOpMaker); REGISTER_OPERATOR(gather_nd_grad, ops::GatherNdGradOp, - ops::GatherNdGradNoNeedBufferVarInference); + ops::GatherNdGradNoNeedBufferVarInferer); REGISTER_OP_CPU_KERNEL(gather_nd, ops::GatherNdOpKernel, ops::GatherNdOpKernel, diff --git a/paddle/fluid/operators/gather_op.cc b/paddle/fluid/operators/gather_op.cc index e3cabb986133b378b98e62de4c25dd1bcf8309e1..6a3abaa600281ac4a9762d5c73d398974abbf041 100644 --- a/paddle/fluid/operators/gather_op.cc +++ b/paddle/fluid/operators/gather_op.cc @@ -127,7 +127,7 @@ class GatherGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(GatherGradNoNeedBufferVarInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(GatherGradNoNeedBufferVarInferer, "X"); } // namespace operators } // namespace paddle @@ -137,7 +137,7 @@ REGISTER_OPERATOR(gather, ops::GatherOp, ops::GatherOpMaker, ops::GatherGradOpMaker, ops::GatherGradOpMaker); REGISTER_OPERATOR(gather_grad, ops::GatherGradOp, - ops::GatherGradNoNeedBufferVarInference); + ops::GatherGradNoNeedBufferVarInferer); REGISTER_OP_CPU_KERNEL(gather, ops::GatherOpKernel, ops::GatherOpKernel, ops::GatherOpKernel, ops::GatherOpKernel, diff --git a/paddle/fluid/operators/gaussian_random_batch_size_like_op.cc b/paddle/fluid/operators/gaussian_random_batch_size_like_op.cc index ab7403a8ba5adb2338f8255d16c66d032eb9b314..d98721cfff300c108eff3f0688eaca07ff2c1fa0 100644 --- a/paddle/fluid/operators/gaussian_random_batch_size_like_op.cc +++ b/paddle/fluid/operators/gaussian_random_batch_size_like_op.cc @@ -74,6 +74,6 @@ REGISTER_OPERATOR( paddle::operators::GaussianRandomBatchSizeLikeOpMaker, paddle::framework::EmptyGradOpMaker, paddle::framework::EmptyGradOpMaker, - paddle::operators::BatchSizeLikeNoNeedBufferVarsInference); + paddle::operators::BatchSizeLikeNoNeedBufferVarsInferer); // Kernels are registered in gaussian_random_op.cc and gaussian_random_op.cu diff --git a/paddle/fluid/operators/group_norm_op.cc b/paddle/fluid/operators/group_norm_op.cc index 793b6079372b410880405cdef5429c118e7459ec..978170b296b421a198b0b108f44b347d349ec047 100644 --- a/paddle/fluid/operators/group_norm_op.cc +++ b/paddle/fluid/operators/group_norm_op.cc @@ -216,8 +216,8 @@ class GroupNormGradMaker : public framework::SingleGradOpMaker { } }; -DECLARE_INPLACE_OP_INFERER(GroupNormInplaceInToOut, {"X", "Y"}); -DECLARE_INPLACE_OP_INFERER(GroupNormGradInplaceInToOut, +DECLARE_INPLACE_OP_INFERER(GroupNormInplaceInferer, {"X", "Y"}); +DECLARE_INPLACE_OP_INFERER(GroupNormGradInplaceInferer, {framework::GradVarName("Y"), framework::GradVarName("X")}); @@ -239,9 +239,9 @@ REGISTER_OPERATOR(group_norm, ops::GroupNormOp, ops::GroupNormOpMaker, ops::GroupNormOpInferVarType, ops::GroupNormGradMaker, ops::GroupNormGradMaker, - ops::GroupNormInplaceInToOut); + ops::GroupNormInplaceInferer); REGISTER_OPERATOR(group_norm_grad, ops::GroupNormGradOp, - ops::GroupNormGradInplaceInToOut); + ops::GroupNormGradInplaceInferer); REGISTER_OP_CPU_KERNEL( group_norm, ops::GroupNormKernel, ops::GroupNormKernel); diff --git a/paddle/fluid/operators/gru_op.cc b/paddle/fluid/operators/gru_op.cc index a9c3612d601479e80b9379d7f92f0b9fcf3cff21..dc82e4fa754ebf586aa37f9bb547c1f5b3416fb8 100644 --- a/paddle/fluid/operators/gru_op.cc +++ b/paddle/fluid/operators/gru_op.cc @@ -456,7 +456,7 @@ class GRUGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(GRUGradOpNoNeedBufferVarInference, "Input", +DECLARE_NO_NEED_BUFFER_VARS_INFERER(GRUGradOpNoNeedBufferVarInferer, "Input", "Bias"); } // namespace operators @@ -467,7 +467,7 @@ REGISTER_OPERATOR(gru, ops::GRUOp, ops::GRUOpMaker, ops::GRUGradOpMaker, ops::GRUGradOpMaker); REGISTER_OPERATOR(gru_grad, ops::GRUGradOp, - ops::GRUGradOpNoNeedBufferVarInference); + ops::GRUGradOpNoNeedBufferVarInferer); REGISTER_OP_CPU_KERNEL(gru, ops::GRUCPUKernel, ops::GRUCPUKernel); REGISTER_OP_CPU_KERNEL( diff --git a/paddle/fluid/operators/gru_unit_op.cc b/paddle/fluid/operators/gru_unit_op.cc index c4225c9088eed1dba350dd3abe4dee88512408b2..1edac8c2a11aac855f5d2362c4043a1e11be7a81 100644 --- a/paddle/fluid/operators/gru_unit_op.cc +++ b/paddle/fluid/operators/gru_unit_op.cc @@ -234,7 +234,7 @@ class GRUUnitGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(GRUUnitGradOpNoNeedBufferVarInference, +DECLARE_NO_NEED_BUFFER_VARS_INFERER(GRUUnitGradOpNoNeedBufferVarInferer, "Bias"); } // namespace operators @@ -246,7 +246,7 @@ REGISTER_OPERATOR(gru_unit, ops::GRUUnitOp, ops::GRUUnitOpMaker, ops::GRUUnitGradOpMaker, ops::GRUUnitGradOpMaker); REGISTER_OPERATOR(gru_unit_grad, ops::GRUUnitGradOp, - ops::GRUUnitGradOpNoNeedBufferVarInference); + ops::GRUUnitGradOpNoNeedBufferVarInferer); REGISTER_OP_CPU_KERNEL( gru_unit, ops::GRUUnitKernel, diff --git a/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc b/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc index 361b3b42ddb567ad7f66d30124b5f3743352fdda..fccf6d46895ff46c40d0a5c20d4cf1b614ad8a9e 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_mean_op.cc @@ -82,8 +82,7 @@ class ReduceMeanDoubleGradOpBaseMaker : public imperative::GradOpBaseMakerBase { } } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(ReduceMeanGradNoNeedBufferVarInference, - "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(ReduceMeanGradNoNeedBufferVarInferer, "X"); } // namespace operators } // namespace paddle @@ -99,7 +98,7 @@ REGISTER_OPERATOR(reduce_mean, ops::ReduceOp, __reduce_meanMaker__, REGISTER_OPERATOR(reduce_mean_grad, ops::ReduceGradOp, ops::ReduceMeanDoubleGradDescMaker, ops::ReduceMeanDoubleGradOpBaseMaker, - ops::ReduceMeanGradNoNeedBufferVarInference); + ops::ReduceMeanGradNoNeedBufferVarInferer); REGISTER_OP_CPU_KERNEL(reduce_mean, ops::ReduceKernel, diff --git a/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc b/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc index 198beafacec05995f97007ee80b0778538b87384..6e470e3af4e5860796d898a5e3138c28958264cb 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_sum_op.cc @@ -51,7 +51,7 @@ class ReduceSumOpGradMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(ReduceSumGradNoNeedBufferVarInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(ReduceSumGradNoNeedBufferVarInferer, "X"); class ReduceSumVarTypeInference : public paddle::framework::VarTypeInference { public: void operator()(paddle::framework::InferVarTypeContext* ctx) const override { @@ -77,7 +77,7 @@ REGISTER_OPERATOR(reduce_sum, ops::ReduceOp, ReduceSumOpMaker, ops::ReduceSumOpGradMaker, ops::ReduceSumOpGradMaker); REGISTER_OPERATOR(reduce_sum_grad, ops::ReduceGradOp, - ops::ReduceSumGradNoNeedBufferVarInference); + ops::ReduceSumGradNoNeedBufferVarInferer); REGISTER_OP_CPU_KERNEL( reduce_sum, ops::ReduceKernel { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(RollGradNoNeedBufferVarsInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(RollGradNoNeedBufferVarsInferer, "X"); } // namespace operators } // namespace paddle @@ -130,7 +130,7 @@ REGISTER_OPERATOR(roll, ops::RollOp, ops::RollOpMaker, ops::RollGradMaker, ops::RollGradMaker); REGISTER_OPERATOR(roll_grad, ops::RollGradOp, - ops::RollGradNoNeedBufferVarsInference); + ops::RollGradNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL( roll, ops::RollKernel, ops::RollKernel, diff --git a/paddle/fluid/operators/scatter_nd_add_op.cc b/paddle/fluid/operators/scatter_nd_add_op.cc index aead6701ea87b1bddceb3ab6f459d293936a53ec..144e7ceae20c1665e5ebd80a8e090f14faf70321 100644 --- a/paddle/fluid/operators/scatter_nd_add_op.cc +++ b/paddle/fluid/operators/scatter_nd_add_op.cc @@ -170,7 +170,7 @@ class ScatterNdAddGradMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(ScatterNdAddGradNoNeedBufferVarsInference, +DECLARE_NO_NEED_BUFFER_VARS_INFERER(ScatterNdAddGradNoNeedBufferVarsInferer, "Updates"); } // namespace operators @@ -183,7 +183,7 @@ REGISTER_OPERATOR(scatter_nd_add, ops::ScatterNdAddOp, ops::ScatterNdAddOpMaker, ops::ScatterNdAddGradMaker); REGISTER_OPERATOR(scatter_nd_add_grad, ops::ScatterNdAddGradOp, - ops::ScatterNdAddGradNoNeedBufferVarsInference); + ops::ScatterNdAddGradNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL(scatter_nd_add, ops::ScatterNdAddOpKernel, ops::ScatterNdAddOpKernel, diff --git a/paddle/fluid/operators/scatter_op.cc b/paddle/fluid/operators/scatter_op.cc index 78442cdf641af7f566d112773949fafeeac3e687..8ee5aa312f7982300997df4822c4b3ff425de8e8 100644 --- a/paddle/fluid/operators/scatter_op.cc +++ b/paddle/fluid/operators/scatter_op.cc @@ -134,7 +134,7 @@ class ScatterGradMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(ScatterGradNoNeedBufferVarsInference, +DECLARE_NO_NEED_BUFFER_VARS_INFERER(ScatterGradNoNeedBufferVarsInferer, "Updates"); DECLARE_INPLACE_OP_INFERER(ScatterInplaceInferer, {"X", "Out"}); @@ -151,7 +151,7 @@ REGISTER_OPERATOR(scatter, ops::ScatterOp, ops::ScatterOpMaker, ops::ScatterGradMaker, ops::ScatterInplaceInferer); REGISTER_OPERATOR(scatter_grad, ops::ScatterGradOp, - ops::ScatterGradNoNeedBufferVarsInference, + ops::ScatterGradNoNeedBufferVarsInferer, ops::ScatterGradInplaceInferer); REGISTER_OP_CPU_KERNEL(scatter, ops::ScatterOpKernel, ops::ScatterOpKernel, ops::ScatterOpKernel, diff --git a/paddle/fluid/operators/sequence_ops/sequence_concat_op.cc b/paddle/fluid/operators/sequence_ops/sequence_concat_op.cc index 272781a7d25e690bb761c374d019eae973be4b39..0d3be48b7637b35ae75c4f425dff1ab1f86a83de 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_concat_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_concat_op.cc @@ -123,8 +123,7 @@ class SeqConcatGradOp : public framework::OperatorWithKernel { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(SeqConcatGradNoNeedBufferVarsInference, - "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SeqConcatGradNoNeedBufferVarsInferer, "X"); } // namespace operators } // namespace paddle @@ -140,7 +139,7 @@ REGISTER_OP_CPU_KERNEL(sequence_concat, Kernel, Kernel, Kernel, Kernel); REGISTER_OPERATOR(sequence_concat_grad, op::SeqConcatGradOp, - op::SeqConcatGradNoNeedBufferVarsInference); + op::SeqConcatGradNoNeedBufferVarsInferer); template using GradKernel = op::SeqConcatGradKernel; 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 d93185388a63ba390b001775741c286e3cdbd41e..494c8e3ab74a03ab3158cc0f37d6035f562f1aea 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_expand_as_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_expand_as_op.cc @@ -181,10 +181,10 @@ class SequenceExpandAsOpGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequenceExpandAsOpNoNeedBufferVarsInference, +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequenceExpandAsOpNoNeedBufferVarsInferer, "Y"); DECLARE_NO_NEED_BUFFER_VARS_INFERER( - SequenceExpandAsGradOpNoNeedBufferVarsInference, "X", "Y"); + SequenceExpandAsGradOpNoNeedBufferVarsInferer, "X", "Y"); } // namespace operators } // namespace paddle @@ -194,9 +194,9 @@ REGISTER_OPERATOR( sequence_expand_as, ops::SequenceExpandAsOp, ops::SequenceExpandAsOpMaker, ops::SequenceExpandAsOpGradOpMaker, ops::SequenceExpandAsOpGradOpMaker, - ops::SequenceExpandAsOpNoNeedBufferVarsInference); + ops::SequenceExpandAsOpNoNeedBufferVarsInferer); REGISTER_OPERATOR(sequence_expand_as_grad, ops::SequenceExpandAsOpGrad, - ops::SequenceExpandAsGradOpNoNeedBufferVarsInference); + ops::SequenceExpandAsGradOpNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL( sequence_expand_as, ops::SequenceExpandAsKernel, diff --git a/paddle/fluid/operators/sequence_ops/sequence_expand_op.cc b/paddle/fluid/operators/sequence_ops/sequence_expand_op.cc index 20251d9533a6283d8604e7403c467a6564327c0f..e4f2c1b2b8fd1d94ebad57880565f05999fcf303 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_expand_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_expand_op.cc @@ -247,10 +247,10 @@ class SequenceExpandOpGradMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequenceExpandOpNoNeedBufferVarsInference, +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequenceExpandOpNoNeedBufferVarsInferer, "Y"); -DECLARE_NO_NEED_BUFFER_VARS_INFERER( - SequenceExpandGradOpNoNeedBufferVarsInference, "X", "Y"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequenceExpandGradOpNoNeedBufferVarsInferer, + "X", "Y"); } // namespace operators } // namespace paddle @@ -260,9 +260,9 @@ REGISTER_OPERATOR(sequence_expand, ops::SequenceExpandOp, ops::SequenceExpandOpMaker, ops::SequenceExpandOpGradMaker, ops::SequenceExpandOpGradMaker, - ops::SequenceExpandOpNoNeedBufferVarsInference); + ops::SequenceExpandOpNoNeedBufferVarsInferer); REGISTER_OPERATOR(sequence_expand_grad, ops::SequenceExpandOpGrad, - ops::SequenceExpandGradOpNoNeedBufferVarsInference); + ops::SequenceExpandGradOpNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL( sequence_expand, ops::SequenceExpandKernel, diff --git a/paddle/fluid/operators/sequence_ops/sequence_pad_op.cc b/paddle/fluid/operators/sequence_ops/sequence_pad_op.cc index 09ea968dfbc2e0440ddc0b3e23b7773e64567744..c14a889bbce6628db3547541c0c1e25b56344955 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_pad_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_pad_op.cc @@ -251,7 +251,7 @@ class SequencePadGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequencePadGradOpNoNeedBufferVarsInference, +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequencePadGradOpNoNeedBufferVarsInferer, "X"); } // namespace operators @@ -262,7 +262,7 @@ REGISTER_OPERATOR(sequence_pad, ops::SequencePadOp, ops::SequencePadOpMaker, ops::SequencePadGradOpMaker, ops::SequencePadGradOpMaker); REGISTER_OPERATOR(sequence_pad_grad, ops::SequencePadGradOp, - ops::SequencePadGradOpNoNeedBufferVarsInference); + ops::SequencePadGradOpNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL( sequence_pad, ops::SequencePadOpKernel, diff --git a/paddle/fluid/operators/sequence_ops/sequence_pool_op.cc b/paddle/fluid/operators/sequence_ops/sequence_pool_op.cc index 8c272c4a15f7128041c671c90dba09a9537d325a..050ab2c9418f69727024aa72a070df54e3e88459 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_pool_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_pool_op.cc @@ -166,7 +166,7 @@ class SequencePoolGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequencePoolGradOpNoNeedBufferVarsInference, +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequencePoolGradOpNoNeedBufferVarsInferer, "X"); } // namespace operators @@ -177,7 +177,7 @@ REGISTER_OPERATOR(sequence_pool, ops::SequencePoolOp, ops::SequencePoolOpMaker, ops::SequencePoolGradOpMaker, ops::SequencePoolGradOpMaker); REGISTER_OPERATOR(sequence_pool_grad, ops::SequencePoolGradOp, - ops::SequencePoolGradOpNoNeedBufferVarsInference); + ops::SequencePoolGradOpNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL( sequence_pool, ops::SequencePoolKernel); diff --git a/paddle/fluid/operators/sequence_ops/sequence_scatter_op.cc b/paddle/fluid/operators/sequence_ops/sequence_scatter_op.cc index 6d681efa13c5d4f94ffe8086ce3eb32c7c4a250d..2d4730635fd2aeb2e20aa5f4a637f94bce075566 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_scatter_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_scatter_op.cc @@ -168,8 +168,8 @@ class SequenceScatterGradMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER( - SequenceScatterGradNoNeedBufferVarsInference, "Updates"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequenceScatterGradNoNeedBufferVarsInferer, + "Updates"); } // namespace operators } // namespace paddle @@ -180,7 +180,7 @@ REGISTER_OPERATOR(sequence_scatter, ops::SequenceScatterOp, ops::SequenceScatterGradMaker, ops::SequenceScatterGradMaker); REGISTER_OPERATOR(sequence_scatter_grad, ops::SequenceScatterGradOp, - ops::SequenceScatterGradNoNeedBufferVarsInference); + ops::SequenceScatterGradNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL(sequence_scatter, ops::SequenceScatterOpKernel, ops::SequenceScatterOpKernel, ops::SequenceScatterOpKernel, diff --git a/paddle/fluid/operators/sequence_ops/sequence_slice_op.cc b/paddle/fluid/operators/sequence_ops/sequence_slice_op.cc index 7787a5c2b898be1060c0f19cec3d1b242842e8d8..06fb444740feea2c490c979e2674440ee8424ca1 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_slice_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_slice_op.cc @@ -137,7 +137,7 @@ class SequenceSliceGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequenceSliceGradNoNeedBufferVarsInference, +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequenceSliceGradNoNeedBufferVarsInferer, "X"); } // namespace operators @@ -149,7 +149,7 @@ REGISTER_OPERATOR(sequence_slice, ops::SequenceSliceOp, ops::SequenceSliceGradOpMaker, ops::SequenceSliceGradOpMaker); REGISTER_OPERATOR(sequence_slice_grad, ops::SequenceSliceGradOp, - ops::SequenceSliceGradNoNeedBufferVarsInference); + ops::SequenceSliceGradNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL( sequence_slice, ops::SequenceSliceOpKernel, diff --git a/paddle/fluid/operators/sequence_ops/sequence_softmax_cudnn_op.cu.cc b/paddle/fluid/operators/sequence_ops/sequence_softmax_cudnn_op.cu.cc index 585363958696fa0d8ed1ffdc7b6fdaab26349b08..b33d87e644fd29a640a1ac9035ef2428d36973b6 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_softmax_cudnn_op.cu.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_softmax_cudnn_op.cu.cc @@ -33,12 +33,17 @@ class SequenceSoftmaxCUDNNKernel : public framework::OpKernel { auto& dims = x->dims(); const size_t level = lod.size() - 1; - PADDLE_ENFORCE_EQ(dims[0], static_cast(lod[level].back()), - "The first dimension of Input(X) should be equal to the " - "sum of all sequences' lengths."); + PADDLE_ENFORCE_EQ( + dims[0], static_cast(lod[level].back()), + platform::errors::InvalidArgument( + "The first dimension of Input(X) should be equal to the sum of all " + "sequences' lengths. But received first dimension of Input(X) is " + "%d, the sum of all sequences' lengths is %d.", + dims[0], static_cast(lod[level].back()))); PADDLE_ENFORCE_EQ(dims[0], x->numel(), - "The width of each timestep in Input(X) of " - "SequenceSoftmaxOp should be 1."); + platform::errors::InvalidArgument( + "The width of each timestep in Input(X) of " + "SequenceSoftmaxOp should be 1.")); out->mutable_data(ctx.GetPlace()); for (int i = 0; i < static_cast(lod[level].size()) - 1; ++i) { diff --git a/paddle/fluid/operators/sequence_ops/sequence_unpad_op.cc b/paddle/fluid/operators/sequence_ops/sequence_unpad_op.cc index 4acb189930ee599e9ae053c8353037052fcc6a8a..c2b6b4af9d8dcc51f424ca1f8092e7d28f61529a 100644 --- a/paddle/fluid/operators/sequence_ops/sequence_unpad_op.cc +++ b/paddle/fluid/operators/sequence_ops/sequence_unpad_op.cc @@ -169,8 +169,8 @@ class SequenceUnpadGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER( - SequenceUnpadGradOpNoNeedBufferVarsInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SequenceUnpadGradOpNoNeedBufferVarsInferer, + "X"); } // namespace operators } // namespace paddle @@ -181,7 +181,7 @@ REGISTER_OPERATOR(sequence_unpad, ops::SequenceUnpadOp, ops::SequenceUnpadGradOpMaker, ops::SequenceUnpadGradOpMaker); REGISTER_OPERATOR(sequence_unpad_grad, ops::SequenceUnpadGradOp, - ops::SequenceUnpadGradOpNoNeedBufferVarsInference); + ops::SequenceUnpadGradOpNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL( sequence_unpad, ops::SequenceUnpadOpKernel, diff --git a/paddle/fluid/operators/slice_op.cc b/paddle/fluid/operators/slice_op.cc index 418159b341fd7c93d230d4f43b1ced89fa5a91ec..13dd89805453d1bdd8a41dcbdd0ad40a18ab5cbf 100644 --- a/paddle/fluid/operators/slice_op.cc +++ b/paddle/fluid/operators/slice_op.cc @@ -377,7 +377,7 @@ class SliceDoubleOpGradMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(SliceOpGradNoNeedBufferVarsInference, +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SliceOpGradNoNeedBufferVarsInferer, "Input"); } // namespace operators @@ -391,7 +391,7 @@ REGISTER_OPERATOR(slice, ops::SliceOp, ops::SliceOpMaker, REGISTER_OPERATOR(slice_grad, ops::SliceOpGrad, ops::SliceDoubleOpGradMaker, ops::SliceDoubleOpGradMaker, - ops::SliceOpGradNoNeedBufferVarsInference, + ops::SliceOpGradNoNeedBufferVarsInferer, ops::SliceOpGradVarTypeInference); REGISTER_OP_CPU_KERNEL( diff --git a/paddle/fluid/operators/space_to_depth_op.cc b/paddle/fluid/operators/space_to_depth_op.cc index fe251a4304530b46fd9b27e047142529761d25e2..3d8ab9bbd861730b23321256b9524231bce1436c 100644 --- a/paddle/fluid/operators/space_to_depth_op.cc +++ b/paddle/fluid/operators/space_to_depth_op.cc @@ -131,7 +131,7 @@ class SpaceToDepthOpMaker : public framework::OpProtoAndCheckerMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(SpaceToDepthGradOpNoBuffer, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SpaceToDepthGradOpNoBufferVarsInferer, "X"); template class SpaceToDepthGradOpMaker : public framework::SingleGradOpMaker { @@ -179,7 +179,7 @@ REGISTER_OPERATOR(space_to_depth, ops::SpaceToDepthOp, ops::SpaceToDepthOpMaker, ops::SpaceToDepthGradOpMaker, ops::SpaceToDepthGradOpMaker); REGISTER_OPERATOR(space_to_depth_grad, ops::SpaceToDepthGradOp, - ops::SpaceToDepthGradOpNoBuffer); + ops::SpaceToDepthGradOpNoBufferVarsInferer); REGISTER_OP_CPU_KERNEL( space_to_depth, ops::SpaceToDepthKernel, diff --git a/paddle/fluid/operators/squared_l2_distance_op.cc b/paddle/fluid/operators/squared_l2_distance_op.cc index 61fd8d3b7cd888b49ec0046afbe49c63215a61ee..274d3dc2df976dff8becd73c6401fda55573b645 100644 --- a/paddle/fluid/operators/squared_l2_distance_op.cc +++ b/paddle/fluid/operators/squared_l2_distance_op.cc @@ -88,7 +88,8 @@ class SquaredL2DistanceOp : public framework::OperatorWithKernel { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(SquaredL2DistanceGradOpNoBuffer, "X", "Y"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SquaredL2DistanceGradOpNoBufferVarsInferer, + "X", "Y"); template class SquaredL2DistanceGradOpMaker : public framework::SingleGradOpMaker { @@ -192,7 +193,7 @@ REGISTER_OPERATOR( ops::SquaredL2DistanceGradOpMaker, ops::SquaredL2DistanceGradOpMaker); REGISTER_OPERATOR(squared_l2_distance_grad, ops::SquaredL2DistanceGradOp, - ops::SquaredL2DistanceGradOpNoBuffer); + ops::SquaredL2DistanceGradOpNoBufferVarsInferer); REGISTER_OP_CPU_KERNEL( squared_l2_distance, ops::SquaredL2DistanceKernel); diff --git a/paddle/fluid/operators/squeeze_op.cc b/paddle/fluid/operators/squeeze_op.cc index 6ba56e0064aea56987d51713877fabcc3ab11416..b658e78629cc2a1e107d7aebf1f5895c15fd4177 100644 --- a/paddle/fluid/operators/squeeze_op.cc +++ b/paddle/fluid/operators/squeeze_op.cc @@ -275,7 +275,7 @@ DECLARE_INPLACE_OP_INFERER(SequeezeInplaceInferer, {"X", "Out"}); DECLARE_INPLACE_OP_INFERER(SequeezeGradInplaceInferer, {framework::GradVarName("Out"), framework::GradVarName("X")}); -DECLARE_NO_NEED_BUFFER_VARS_INFERER(SqueezeGradNoNeedBufferVarsInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(SqueezeGradNoNeedBufferVarsInferer, "X"); } // namespace operators } // namespace paddle @@ -284,7 +284,7 @@ REGISTER_OPERATOR(squeeze, ops::SqueezeOp, ops::SqueezeOpMaker, ops::SqueezeGradOpMaker, ops::SqueezeGradOpMaker); REGISTER_OPERATOR(squeeze_grad, ops::SqueezeGradOp, - ops::SqueezeGradNoNeedBufferVarsInference); + ops::SqueezeGradNoNeedBufferVarsInferer); REGISTER_OPERATOR(squeeze2, ops::Squeeze2Op, ops::Squeeze2OpMaker, ops::Squeeze2GradOpMaker, diff --git a/paddle/fluid/operators/strided_slice_op.cc b/paddle/fluid/operators/strided_slice_op.cc index ca1a16561f98cbbba221299696d355add9c2df94..f8e5d9171087cf09e0781012f845b82b12e14df5 100644 --- a/paddle/fluid/operators/strided_slice_op.cc +++ b/paddle/fluid/operators/strided_slice_op.cc @@ -304,7 +304,7 @@ class StridedSliceOpGradMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(StridedSliceOpGradNoNeedBufferVarsInference, +DECLARE_NO_NEED_BUFFER_VARS_INFERER(StridedSliceOpGradNoNeedBufferVarsInferer, "Input"); } // namespace operators @@ -315,7 +315,7 @@ REGISTER_OPERATOR(strided_slice, ops::StridedSliceOp, ops::StridedSliceOpMaker, ops::StridedSliceOpGradMaker, ops::StridedSliceOpGradMaker); REGISTER_OPERATOR(strided_slice_grad, ops::StridedSliceOpGrad, - ops::StridedSliceOpGradNoNeedBufferVarsInference); + ops::StridedSliceOpGradNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL( strided_slice, diff --git a/paddle/fluid/operators/trace_op.cc b/paddle/fluid/operators/trace_op.cc index 51399b68a1dfc15a8647c7825bfb53a722aa3ad8..6bb158c5816762a6d9c4660f49b3fb48168d57f6 100644 --- a/paddle/fluid/operators/trace_op.cc +++ b/paddle/fluid/operators/trace_op.cc @@ -147,8 +147,7 @@ class TraceGradOpMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(TraceGradNoNeedBufferVarsInference, - "Input"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(TraceGradNoNeedBufferVarsInferer, "Input"); } // namespace operators } // namespace paddle @@ -159,7 +158,7 @@ REGISTER_OPERATOR(trace, ops::TraceOp, ops::TraceOpMaker, ops::TraceGradOpMaker); REGISTER_OPERATOR(trace_grad, ops::TraceOpGrad, - ops::TraceGradNoNeedBufferVarsInference); + ops::TraceGradNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL( trace, ops::TraceKernel, ops::TraceKernel, diff --git a/paddle/fluid/operators/unfold_op.cc b/paddle/fluid/operators/unfold_op.cc index fd592bf35a834064dddaaa16f8ec1274b6f838e6..0a36b6ef8408873a532883031e831a5ea21838e0 100644 --- a/paddle/fluid/operators/unfold_op.cc +++ b/paddle/fluid/operators/unfold_op.cc @@ -174,7 +174,7 @@ class UnfoldGradMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(UnfoldGradOpNoNeedBufferVarsInference, "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(UnfoldGradOpNoNeedBufferVarsInferer, "X"); } // namespace operators } // namespace paddle @@ -184,7 +184,7 @@ REGISTER_OPERATOR(unfold, ops::UnfoldOp, ops::UnfoldOpMaker, ops::UnfoldGradMaker, ops::UnfoldGradMaker); REGISTER_OPERATOR(unfold_grad, ops::UnfoldGradOp, - ops::UnfoldGradOpNoNeedBufferVarsInference); + ops::UnfoldGradOpNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL( unfold, ops::UnfoldOpKernel, diff --git a/paddle/fluid/operators/uniform_random_batch_size_like_op.cc b/paddle/fluid/operators/uniform_random_batch_size_like_op.cc index f90bb4be03474e48e1ac6a4ea00b5a7732ed69be..a9191c09ea1c6710d8f2046344886eb1d03bdb29 100644 --- a/paddle/fluid/operators/uniform_random_batch_size_like_op.cc +++ b/paddle/fluid/operators/uniform_random_batch_size_like_op.cc @@ -78,5 +78,5 @@ REGISTER_OPERATOR( paddle::operators::UniformRandomBatchSizeLikeOpMaker, paddle::framework::EmptyGradOpMaker, paddle::framework::EmptyGradOpMaker, - paddle::operators::BatchSizeLikeNoNeedBufferVarsInference); + paddle::operators::BatchSizeLikeNoNeedBufferVarsInferer); // Kernels are registered in uniform_random_op.cc and uniform_random_op.cu diff --git a/paddle/fluid/operators/unsqueeze_op.cc b/paddle/fluid/operators/unsqueeze_op.cc index e191481f3b18cac5b3a470fe2ac33afaa3c21308..c33e7c6068648d019a38450a92fec79032411598 100644 --- a/paddle/fluid/operators/unsqueeze_op.cc +++ b/paddle/fluid/operators/unsqueeze_op.cc @@ -306,8 +306,7 @@ DECLARE_INPLACE_OP_INFERER(UnsqueezeInplaceInferer, {"X", "Out"}); DECLARE_INPLACE_OP_INFERER(UnsqueezeGradInplaceInferer, {framework::GradVarName("Out"), framework::GradVarName("X")}); -DECLARE_NO_NEED_BUFFER_VARS_INFERER(UnsqueezeGradOpNoNeedBufferVarInference, - "X"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(UnsqueezeGradOpNoNeedBufferVarInferer, "X"); } // namespace operators } // namespace paddle @@ -316,7 +315,7 @@ REGISTER_OPERATOR(unsqueeze, ops::UnsqueezeOp, ops::UnsqueezeOpMaker, ops::UnsqueezeGradOpMaker, ops::UnsqueezeGradOpMaker); REGISTER_OPERATOR(unsqueeze_grad, ops::UnsqueezeGradOp, - ops::UnsqueezeGradOpNoNeedBufferVarInference); + ops::UnsqueezeGradOpNoNeedBufferVarInferer); REGISTER_OPERATOR(unsqueeze2, ops::Unsqueeze2Op, ops::Unsqueeze2OpMaker, ops::Unsqueeze2GradOpMaker, diff --git a/paddle/fluid/operators/warpctc_op.cc b/paddle/fluid/operators/warpctc_op.cc index aa06b67a3e1c89b0944cd949aff555970ad21fd5..5dcbabc96b4dfd287b81e29b37db196435dc7ce2 100644 --- a/paddle/fluid/operators/warpctc_op.cc +++ b/paddle/fluid/operators/warpctc_op.cc @@ -184,7 +184,7 @@ class WarpCTCGradOp : public framework::OperatorWithKernel { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(WarpCTCGradOpNoNeedBufferVarInference, +DECLARE_NO_NEED_BUFFER_VARS_INFERER(WarpCTCGradOpNoNeedBufferVarInferer, "Logits"); } // namespace operators @@ -195,7 +195,7 @@ REGISTER_OPERATOR(warpctc, ops::WarpCTCOp, ops::WarpCTCOpMaker, ops::WarpCTCGradOpMaker, ops::WarpCTCGradOpMaker); REGISTER_OPERATOR(warpctc_grad, ops::WarpCTCGradOp, - ops::WarpCTCGradOpNoNeedBufferVarInference); + ops::WarpCTCGradOpNoNeedBufferVarInferer); REGISTER_OP_CPU_KERNEL( warpctc, ops::WarpCTCKernel); REGISTER_OP_CPU_KERNEL( diff --git a/paddle/fluid/operators/where_op.cc b/paddle/fluid/operators/where_op.cc index 7b198cf22401f8f4a2e04fba0b916d4138c1dcdb..92ed2bbdc33f55315b3dddf8dc106b7716e97a6f 100644 --- a/paddle/fluid/operators/where_op.cc +++ b/paddle/fluid/operators/where_op.cc @@ -135,8 +135,7 @@ class WhereOpGradMaker : public framework::SingleGradOpMaker { } }; -DECLARE_NO_NEED_BUFFER_VARS_INFERER(WhereGradNoNeedBufferVarsInference, "X", - "Y"); +DECLARE_NO_NEED_BUFFER_VARS_INFERER(WhereGradNoNeedBufferVarsInferer, "X", "Y"); } // namespace operators } // namespace paddle @@ -146,7 +145,7 @@ REGISTER_OPERATOR(where, ops::WhereOp, ops::WhereOpMaker, ops::WhereOpGradMaker); REGISTER_OPERATOR(where_grad, ops::WhereGradOp, - ops::WhereGradNoNeedBufferVarsInference); + ops::WhereGradNoNeedBufferVarsInferer); REGISTER_OP_CPU_KERNEL( where, ops::WhereKernel, ops::WhereKernel, diff --git a/paddle/fluid/platform/device_tracer.cc b/paddle/fluid/platform/device_tracer.cc index 6be8ed25e3fe4b817146b359da5e602d52192ab4..f2266bd78ce678333f1e20f3522ac8d9b444184e 100644 --- a/paddle/fluid/platform/device_tracer.cc +++ b/paddle/fluid/platform/device_tracer.cc @@ -641,22 +641,24 @@ DeviceTracer *GetDeviceTracer() { return tracer; } -std::string SetCurAnnotation(Event *event) { +// In order to record PE time, we add main_thread_annotation_stack +// for all event between PE run, we treat it as PE's child Event, +// so when event is not in same thread of PE event, we need add +// father event(PE::run event) for this event +void SetCurAnnotation(Event *event) { std::string ret; - if (!annotation_stack.empty() && event->role() != EventRole::kSpecial) { + if (!annotation_stack.empty()) { event->set_parent(annotation_stack.back()); event->set_name(annotation_stack.back()->name() + "/" + event->name()); } - + if (annotation_stack.empty() && !main_thread_annotation_stack.empty() && + main_thread_annotation_stack.back()->thread_id() != event->thread_id()) { + event->set_parent(main_thread_annotation_stack.back()); + event->set_name(main_thread_annotation_stack.back()->name() + "/" + + event->name()); + } annotation_stack.push_back(event); - if (!main_thread_annotation_stack_name.empty() && !annotation_stack.empty() && - main_thread_annotation_stack.back()->thread_id() != - annotation_stack.back()->thread_id()) { - ret = main_thread_annotation_stack_name.back() + "/" + event->name(); - } else { - ret = event->name(); - } if (event->role() == EventRole::kSpecial) { std::string name = event->name(); if (!main_thread_annotation_stack_name.empty()) { @@ -665,22 +667,23 @@ std::string SetCurAnnotation(Event *event) { main_thread_annotation_stack_name.push_back(name); main_thread_annotation_stack.push_back(event); } - - return ret; } void ClearCurAnnotation() { - if (!main_thread_annotation_stack_name.empty() && !annotation_stack.empty() && - main_thread_annotation_stack.back()->thread_id() != - annotation_stack.back()->thread_id()) { - annotation_stack.back()->set_name(main_thread_annotation_stack_name.back() + - "/" + annotation_stack.back()->name()); - } if (!main_thread_annotation_stack.empty() && main_thread_annotation_stack.back()->name() == annotation_stack.back()->name()) { - main_thread_annotation_stack_name.pop_back(); - main_thread_annotation_stack.pop_back(); + std::string name = annotation_stack.back()->name(); + std::string main_name = main_thread_annotation_stack.back()->name(); + int main_name_len = main_name.length(); + int name_len = name.length(); + int prefix_len = main_name_len - name_len; + + if (prefix_len >= 0 && main_name.at(prefix_len) == '/' && + name == main_name.substr(prefix_len, name_len)) { + main_thread_annotation_stack_name.pop_back(); + main_thread_annotation_stack.pop_back(); + } } annotation_stack.pop_back(); } diff --git a/paddle/fluid/platform/device_tracer.h b/paddle/fluid/platform/device_tracer.h index 44b7af149efa9214fe5d9177755541fba4c70ab4..85168a046fb3fa4317956737871cde56e15bedfb 100644 --- a/paddle/fluid/platform/device_tracer.h +++ b/paddle/fluid/platform/device_tracer.h @@ -137,7 +137,7 @@ class DeviceTracer { DeviceTracer* GetDeviceTracer(); // Set a name for the cuda kernel operation being launched by the thread. -std::string SetCurAnnotation(Event* event); +void SetCurAnnotation(Event* event); // Clear the name after the operation is done. void ClearCurAnnotation(); // Current name of the operation being run in the thread. diff --git a/paddle/fluid/platform/profiler.cc b/paddle/fluid/platform/profiler.cc index be655255bd838a17fa0ffeba274d21c73fd3820a..22e00b89239fcb556efe56d50c3ed209664ee7e3 100644 --- a/paddle/fluid/platform/profiler.cc +++ b/paddle/fluid/platform/profiler.cc @@ -73,7 +73,8 @@ RecordEvent::RecordEvent(const std::string &name, const EventRole role) { // lock is not needed, the code below is thread-safe Event *e = PushEvent(name, role); // Maybe need the same push/pop behavior. - name_ = SetCurAnnotation(e); + SetCurAnnotation(e); + name_ = e->name(); } RecordEvent::~RecordEvent() { diff --git a/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py b/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py index fcf7a51113563667b6449f2764f4950c0150308d..f04869156f95cbc5d7b8f2cee0974658d02f4a32 100644 --- a/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py +++ b/python/paddle/fluid/contrib/slim/quantization/quantization_pass.py @@ -83,7 +83,7 @@ _op_real_in_out_name = { "swish": [["X"], ["Out"]], "dropout": [["X"], ["Out"]], "batch_norm": [["X"], ["Y"]], - "sigmoid": [["X"], ["Y"]], + "sigmoid": [["X"], ["Out"]], } diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/program_translator.py b/python/paddle/fluid/dygraph/dygraph_to_static/program_translator.py index 4b57301388ef7003586c345a9352389d427feb26..d54916a72c898076185f163614d50ec9ff4ff607 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/program_translator.py +++ b/python/paddle/fluid/dygraph/dygraph_to_static/program_translator.py @@ -550,6 +550,7 @@ class ProgramTranslator(object): source_code = ast_to_source_code(root_wrapper.node) return source_code + @switch_to_static_graph def save_inference_model(self, dirname, feed=None, fetch=None): """ Saves current model as the inference model. It will prune the main_program diff --git a/python/paddle/fluid/dygraph/math_op_patch.py b/python/paddle/fluid/dygraph/math_op_patch.py index b15e6388884c7b194654f3c3b71b8c111f76e565..d2c779a85497917179736777dac25efa7cfba228 100644 --- a/python/paddle/fluid/dygraph/math_op_patch.py +++ b/python/paddle/fluid/dygraph/math_op_patch.py @@ -37,9 +37,6 @@ def monkey_patch_math_varbase(): The difference is, in dygraph mode, use auto-generated op functions for better performance. """ - def safe_get_dtype(var): - return var.dtype - @no_grad def create_tensor(value, dtype, shape): out = _varbase_creator(dtype=dtype) @@ -96,8 +93,9 @@ def monkey_patch_math_varbase(): print("new var's dtype is: {}, numpy dtype is {}".format(new_variable.dtype, new_variable.numpy().dtype)) """ - return core.ops.cast(self, 'in_dtype', self.dtype, 'out_dtype', - convert_np_dtype_to_dtype_(dtype)) + if not isinstance(dtype, core.VarDesc.VarType): + dtype = convert_np_dtype_to_dtype_(dtype) + return core.ops.cast(self, 'in_dtype', self.dtype, 'out_dtype', dtype) def _scalar_elementwise_op_(var, scale, bias): return core.ops.scale(var, 'scale', scale, 'bias', bias) @@ -175,7 +173,7 @@ def monkey_patch_math_varbase(): elif isinstance(other_var, int): return scalar_method(self, float(other_var)) - lhs_dtype = safe_get_dtype(self) + lhs_dtype = self.dtype if not isinstance(other_var, core.VarBase): if reverse: @@ -185,7 +183,7 @@ def monkey_patch_math_varbase(): # add fill_op other_var = create_scalar(value=other_var, dtype=lhs_dtype) - rhs_dtype = safe_get_dtype(other_var) + rhs_dtype = other_var.dtype if lhs_dtype != rhs_dtype: other_var = astype(other_var, lhs_dtype) if reverse: diff --git a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_mnist.py b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_mnist.py index 2880dd00559c33aa6dc9987d715a9cf87ac8e1cb..722b0f14fa060cb843aedf25e9b1ca9ee0ac4407 100644 --- a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_mnist.py +++ b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_mnist.py @@ -200,7 +200,6 @@ class TestMNISTWithDeclarative(TestMNIST): break return loss_data - @switch_to_static_graph def check_save_inference_model(self, inputs, prog_trans, to_static, gt_out): if to_static: infer_model_path = "./test_mnist_inference_model" @@ -208,6 +207,7 @@ class TestMNISTWithDeclarative(TestMNIST): infer_out = self.load_and_run_inference(infer_model_path, inputs) self.assertTrue(np.allclose(gt_out.numpy(), infer_out)) + @switch_to_static_graph def load_and_run_inference(self, model_path, inputs): exe = fluid.Executor(self.place) [inference_program, feed_target_names, diff --git a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_save_inference_model.py b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_save_inference_model.py index 7414d240bf5727886f0d8ae5b493194f0bdd25e3..180ada7b9a769731e82db239dc696e23c13feed5 100644 --- a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_save_inference_model.py +++ b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_save_inference_model.py @@ -30,6 +30,7 @@ np.random.seed(SEED) place = fluid.CUDAPlace(0) if fluid.is_compiled_with_cuda() else fluid.CPUPlace( ) +program_translator = ProgramTranslator() class SimpleFcLayer(fluid.dygraph.Layer): @@ -63,6 +64,10 @@ class TestDyToStaticSaveInferenceModel(unittest.TestCase): loss.backward() adam.minimize(loss) layer.clear_gradients() + # test for saving model in dygraph.guard + infer_model_dir = "./test_dy2stat_save_inference_model" + program_translator.save_inference_model( + infer_model_dir, feed=[0], fetch=[1]) # Check the correctness of the inference dygraph_out, _ = layer(x) self.check_save_inference_model(layer, [x_data], dygraph_out.numpy()) @@ -77,7 +82,7 @@ class TestDyToStaticSaveInferenceModel(unittest.TestCase): gt_out, feed=None, fetch=None): - program_translator = ProgramTranslator() + expected_persistable_vars = set([p.name for p in model.parameters()]) infer_model_dir = "./test_dy2stat_save_inference_model" diff --git a/python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py b/python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py index 607e97ef430e15201197eefc711918a6afd20794..f4418150e8a69d795ff544073b6ba6dd7431e44b 100644 --- a/python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py +++ b/python/paddle/fluid/tests/unittests/test_conv2d_transpose_op.py @@ -109,6 +109,7 @@ class TestConv2dTransposeOp(OpTest): def setUp(self): # init as conv transpose self.dtype = np.float64 + self.need_check_grad = True self.is_test = False self.use_cudnn = False self.use_mkldnn = False @@ -152,35 +153,40 @@ class TestConv2dTransposeOp(OpTest): self.check_output(check_dygraph=(self.use_mkldnn == False)) def test_check_grad_no_input(self): - if self.use_cudnn: - place = core.CUDAPlace(0) - self.check_grad_with_place( - place, ['Filter'], - 'Output', - max_relative_error=0.02, - no_grad_set=set(['Input'])) - else: - self.check_grad(['Filter'], 'Output', no_grad_set=set(['Input'])) + if self.need_check_grad: + if self.use_cudnn: + place = core.CUDAPlace(0) + self.check_grad_with_place( + place, ['Filter'], + 'Output', + max_relative_error=0.02, + no_grad_set=set(['Input'])) + else: + self.check_grad( + ['Filter'], 'Output', no_grad_set=set(['Input'])) def test_check_grad_no_filter(self): - if self.use_cudnn: - place = core.CUDAPlace(0) - self.check_grad_with_place( - place, ['Input'], 'Output', no_grad_set=set(['Filter'])) - else: - self.check_grad(['Input'], 'Output', no_grad_set=set(['Filter'])) + if self.need_check_grad: + if self.use_cudnn: + place = core.CUDAPlace(0) + self.check_grad_with_place( + place, ['Input'], 'Output', no_grad_set=set(['Filter'])) + else: + self.check_grad( + ['Input'], 'Output', no_grad_set=set(['Filter'])) def test_check_grad(self): - if self.use_cudnn: - place = core.CUDAPlace(0) - self.check_grad_with_place( - place, - set(['Input', 'Filter']), - 'Output', - max_relative_error=0.02) - else: - self.check_grad( - set(['Input', 'Filter']), 'Output', max_relative_error=0.02) + if self.need_check_grad: + if self.use_cudnn: + place = core.CUDAPlace(0) + self.check_grad_with_place( + place, + set(['Input', 'Filter']), + 'Output', + max_relative_error=0.02) + else: + self.check_grad( + set(['Input', 'Filter']), 'Output', max_relative_error=0.02) def init_test_case(self): self.pad = [0, 0] @@ -708,6 +714,124 @@ class TestDepthwiseConvTransposeAsymmetricPad_NHWC(TestConv2dTransposeOp): self.data_format = 'NHWC' +@unittest.skipIf(not core.is_compiled_with_cuda(), + "core is not compiled with CUDA") +class TestCUDNN_FP16(TestConv2dTransposeOp): + def init_test_case(self): + self.dtype = np.float16 + self.pad = [1, 1] + self.stride = [1, 1] + self.groups = 1 + self.dilations = [1, 1] + self.input_size = [2, 3, 5, 5] # NCHW + f_c = self.input_size[1] + self.filter_size = [f_c, 6, 3, 3] + + def init_op_type(self): + self.need_check_grad = False + self.use_cudnn = True + self.op_type = "conv2d_transpose" + + def test_check_output(self): + if self.use_cudnn: + place = core.CUDAPlace(0) + self.check_output_with_place( + place, atol=0.02, check_dygraph=(self.use_mkldnn == False)) + else: + self.check_output(check_dygraph=(self.use_mkldnn == False)) + + +@unittest.skipIf(not core.is_compiled_with_cuda(), + "core is not compiled with CUDA") +class TestCUDNN_NHWC_FP16(TestCUDNN_FP16): + def init_test_case(self): + self.dtype = np.float16 + self.pad = [0, 0] + self.stride = [1, 1] + self.dilations = [1, 1] + self.groups = 1 + self.input_size = [2, 5, 5, 3] # NHWC + f_c = self.input_size[-1] + self.filter_size = [f_c, 6, 3, 3] + self.data_format = 'NHWC' + + +@unittest.skipIf(not core.is_compiled_with_cuda(), + "core is not compiled with CUDA") +class TestCUDNNWithSymmetricPad_NHWC_FP16(TestCUDNN_FP16): + def init_test_case(self): + self.dtype = np.float16 + self.pad = [1, 1] + self.stride = [1, 1] + self.groups = 1 + self.dilations = [1, 1] + self.input_size = [2, 5, 5, 3] # NHWC + f_c = self.input_size[-1] + self.filter_size = [f_c, 6, 3, 3] + self.data_format = 'NHWC' + + +@unittest.skipIf(not core.is_compiled_with_cuda(), + "core is not compiled with CUDA") +class TestCUDNNWithAsymmetricPad_NHWC_FP16(TestCUDNN_FP16): + def init_test_case(self): + self.dtype = np.float16 + self.pad = [1, 0, 2, 3] + self.stride = [2, 2] + self.groups = 1 + self.dilations = [1, 1] + self.input_size = [2, 5, 5, 3] # NHWC + f_c = self.input_size[-1] + self.filter_size = [f_c, 6, 3, 3] + self.data_format = 'NHWC' + + +@unittest.skipIf(not core.is_compiled_with_cuda(), + "core is not compiled with CUDA") +class TestCUDNNWithStride_NHWC_FP16(TestCUDNN_FP16): + def init_test_case(self): + self.dtype = np.float16 + self.pad = [1, 1] + self.stride = [2, 2] + self.groups = 1 + self.dilations = [1, 1] + self.input_size = [2, 5, 5, 3] # NHWC + f_c = self.input_size[-1] + self.filter_size = [f_c, 6, 3, 3] + self.data_format = 'NHWC' + + +@unittest.skipIf(not core.is_compiled_with_cuda(), + "core is not compiled with CUDA") +class TestCUDNNWithGroups_NHWC_FP16(TestCUDNN_FP16): + def init_test_case(self): + self.dtype = np.float16 + self.pad = [1, 1] + self.stride = [1, 1] + self.dilations = [1, 1] + self.groups = 2 + self.input_size = [2, 5, 5, 4] # NCHW + f_c = self.input_size[-1] + self.filter_size = [f_c, 3, 3, 3] + self.data_format = 'NHWC' + + +@unittest.skipIf(not core.is_compiled_with_cuda(), + "core is not compiled with CUDA") +class TestCUDNNWithEvenUpsample_NHWC_FP16(TestCUDNN_FP16): + def init_test_case(self): + self.dtype = np.float16 + self.pad = [2, 2] + self.stride = [2, 2] + self.groups = 1 + self.dilations = [1, 1] + self.output_size = [14, 14] + self.input_size = [2, 7, 7, 3] # NHWC + f_c = self.input_size[-1] + self.filter_size = [f_c, 6, 5, 5] + self.data_format = 'NHWC' + + class TestConv2dTransposeAPI(unittest.TestCase): def test_case1(self): data1 = fluid.layers.data( diff --git a/python/paddle/fluid/tests/unittests/test_math_op_patch_var_base.py b/python/paddle/fluid/tests/unittests/test_math_op_patch_var_base.py index 34f14b759526026f66930a4ba5322b5363fbb50f..14c3fb7c8bf06908bd8eabffbe46887a6546f6d2 100644 --- a/python/paddle/fluid/tests/unittests/test_math_op_patch_var_base.py +++ b/python/paddle/fluid/tests/unittests/test_math_op_patch_var_base.py @@ -15,7 +15,6 @@ from __future__ import print_function import unittest -from decorator_helper import prog_scope import paddle.fluid as fluid import numpy as np import six @@ -23,7 +22,7 @@ import six class TestMathOpPatchesVarBase(unittest.TestCase): def setUp(self): - self.shape = [10, 10] + self.shape = [10, 1024] self.dtype = np.float32 def test_add(self): @@ -251,6 +250,29 @@ class TestMathOpPatchesVarBase(unittest.TestCase): rtol=1e-05, atol=0.0)) + def test_add_different_dtype(self): + a_np = np.random.random(self.shape).astype(np.float32) + b_np = np.random.random(self.shape).astype(np.float16) + with fluid.dygraph.guard(): + a = fluid.dygraph.to_variable(a_np) + b = fluid.dygraph.to_variable(b_np) + res = a + b + self.assertTrue(np.array_equal(res.numpy(), a_np + b_np)) + + def test_astype(self): + a_np = np.random.uniform(-1, 1, self.shape).astype(self.dtype) + with fluid.dygraph.guard(): + a = fluid.dygraph.to_variable(a_np) + res1 = a.astype(np.float16) + res2 = a.astype('float16') + res3 = a.astype(fluid.core.VarDesc.VarType.FP16) + + self.assertEqual(res1.dtype, res2.dtype) + self.assertEqual(res1.dtype, res3.dtype) + + self.assertTrue(np.array_equal(res1.numpy(), res2.numpy())) + self.assertTrue(np.array_equal(res1.numpy(), res3.numpy())) + if __name__ == '__main__': unittest.main() diff --git a/python/paddle/fluid/tests/unittests/white_list/op_accuracy_white_list.py b/python/paddle/fluid/tests/unittests/white_list/op_accuracy_white_list.py index 0f5918544a3bf29757241efb74938e4aa5ff0a6f..ae99aeff557e4aa31f2868fbb8be9d038d5538ca 100644 --- a/python/paddle/fluid/tests/unittests/white_list/op_accuracy_white_list.py +++ b/python/paddle/fluid/tests/unittests/white_list/op_accuracy_white_list.py @@ -80,5 +80,6 @@ NO_FP16_CHECK_GRAD_OP_LIST = [ 'fused_elemwise_activation', \ 'pool2d', \ 'pool3d', \ - 'softmax' + 'softmax',\ + 'conv2d_transpose' ] diff --git a/tools/check_ut.py b/tools/check_ut.py index 6e507d6543fe4c17299b5fc657c4e37dcc371f17..7b5e5a4f1c55574edc3f28dac76ebf1d932748d7 100644 --- a/tools/check_ut.py +++ b/tools/check_ut.py @@ -28,7 +28,7 @@ class PRChecker(object): self.repo = None def check(self): - """ check pr """ + """ check pr. """ filename = 'block.txt' pr_id = os.getenv('GIT_PR_ID') if not pr_id: @@ -44,7 +44,8 @@ class PRChecker(object): with open(filename) as f: for l in f: if l.rstrip('\r\n') == user: - print('{} has UT to be fixed, so CI failed.'.format(user)) + print('{} has unit-test to be fixed, so CI failed.'.format( + user)) exit(1) exit(0) diff --git a/tools/manylinux1/Dockerfile.cuda10_cudnn7_gcc8_ubuntu16 b/tools/manylinux1/Dockerfile.cuda10_cudnn7_gcc8_ubuntu16 index 242c071c0f828423ac4b09b228c280c55f8c8afa..7f9fd22cc1757b34b95c2e8aa14bee237e95d2a6 100644 --- a/tools/manylinux1/Dockerfile.cuda10_cudnn7_gcc8_ubuntu16 +++ b/tools/manylinux1/Dockerfile.cuda10_cudnn7_gcc8_ubuntu16 @@ -19,6 +19,15 @@ ENV HOME /root # Add bash enhancements COPY ./paddle/scripts/docker/root/ /root/ +ENV PATH=/usr/local/gcc-8.2/bin:$PATH +RUN rm -rf /temp_gcc82 && rm -rf /gcc-8.2.0.tar.xz && rm -rf /gcc-8.2.0 + +# Prepare packages for Python +RUN apt-get update && \ + apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ + libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ + xz-utils tk-dev libffi-dev liblzma-dev + # gcc8.2 RUN wget -q https://paddle-docker-tar.bj.bcebos.com/home/users/tianshuo/bce-python-sdk-0.8.27/gcc-8.2.0.tar.xz && \ tar -xvf gcc-8.2.0.tar.xz && \ @@ -33,23 +42,6 @@ RUN wget -q https://paddle-docker-tar.bj.bcebos.com/home/users/tianshuo/bce-pyth ENV PATH=/usr/local/gcc-8.2/bin:$PATH RUN rm -rf /temp_gcc82 && rm -rf /gcc-8.2.0.tar.xz && rm -rf /gcc-8.2.0 -# Prepare packages for Python -RUN apt-get update && \ - apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ - libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ - xz-utils tk-dev libffi-dev liblzma-dev - -# Downgrade gcc&&g++ -RUN apt-get update -WORKDIR /usr/bin -RUN apt install -y gcc-4.8 g++-4.8 -RUN cp gcc gcc.bak -RUN cp g++ g++.bak -RUN rm gcc -RUN rm g++ -RUN ln -s gcc-4.8 gcc -RUN ln -s g++-4.8 g++ - # Install Python3.6 RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \ tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \