From a414e9478c2da92b61cc504a331c78ae4dd7cc23 Mon Sep 17 00:00:00 2001 From: Kaipeng Deng Date: Fri, 13 Mar 2020 20:48:33 +0800 Subject: [PATCH] fit for new GradMaker (#4425) --- PaddleCV/Paddle3D/PointNet++/ext_op/src/gather_point_op.cc | 4 +--- PaddleCV/Paddle3D/PointNet++/ext_op/src/group_points_op.cc | 4 +--- PaddleCV/Paddle3D/PointNet++/ext_op/src/three_interp_op.cc | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/PaddleCV/Paddle3D/PointNet++/ext_op/src/gather_point_op.cc b/PaddleCV/Paddle3D/PointNet++/ext_op/src/gather_point_op.cc index 0f41f1b3..d1513684 100644 --- a/PaddleCV/Paddle3D/PointNet++/ext_op/src/gather_point_op.cc +++ b/PaddleCV/Paddle3D/PointNet++/ext_op/src/gather_point_op.cc @@ -94,15 +94,13 @@ public: using framework::SingleGradOpMaker::SingleGradOpMaker; protected: - std::unique_ptr Apply() const override { - auto* op = new T(); + void Apply(GradOpPtr op) const override { op->SetType("gather_point_grad"); op->SetInput("X", this->Input("X")); op->SetInput("Index", this->Input("Index")); op->SetInput(framework::GradVarName("Output"), this->OutputGrad("Output")); op->SetOutput(framework::GradVarName("X"), this->InputGrad("X")); op->SetAttrMap(this->Attrs()); - return std::unique_ptr(op); } }; diff --git a/PaddleCV/Paddle3D/PointNet++/ext_op/src/group_points_op.cc b/PaddleCV/Paddle3D/PointNet++/ext_op/src/group_points_op.cc index 7266c553..7708c57b 100644 --- a/PaddleCV/Paddle3D/PointNet++/ext_op/src/group_points_op.cc +++ b/PaddleCV/Paddle3D/PointNet++/ext_op/src/group_points_op.cc @@ -102,15 +102,13 @@ class GroupPointsGradDescMaker : public framework::SingleGradOpMaker { using framework::SingleGradOpMaker::SingleGradOpMaker; protected: - std::unique_ptr Apply() const override { - auto* op = new T(); + void Apply(GradOpPtr op) const override { op->SetType("group_points_grad"); op->SetInput("X", this->Input("X")); op->SetInput("Idx", this->Input("Idx")); op->SetInput(framework::GradVarName("Out"), this->OutputGrad("Out")); op->SetOutput(framework::GradVarName("X"), this->InputGrad("X")); op->SetAttrMap(this->Attrs()); - return std::unique_ptr(op); } }; diff --git a/PaddleCV/Paddle3D/PointNet++/ext_op/src/three_interp_op.cc b/PaddleCV/Paddle3D/PointNet++/ext_op/src/three_interp_op.cc index b7bfbe7f..2b7a3be4 100644 --- a/PaddleCV/Paddle3D/PointNet++/ext_op/src/three_interp_op.cc +++ b/PaddleCV/Paddle3D/PointNet++/ext_op/src/three_interp_op.cc @@ -117,8 +117,7 @@ public: using framework::SingleGradOpMaker::SingleGradOpMaker; protected: - std::unique_ptr Apply() const override { - auto* op = new T(); + void Apply(GradOpPtr op) const override { op->SetType("three_interp_grad"); op->SetInput("X", this->Input("X")); op->SetInput("Weight", this->Input("Weight")); @@ -126,7 +125,6 @@ protected: op->SetInput(framework::GradVarName("Out"), this->OutputGrad("Out")); op->SetOutput(framework::GradVarName("X"), this->InputGrad("X")); op->SetAttrMap(this->Attrs()); - return std::unique_ptr(op); } }; -- GitLab