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 0f41f1b3ad7cfc22e7fa7abfa8cbfa277ad9b136..d15136841fddcbe129d1d047982b0e493b43f074 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 7266c553b2d2da95a8fa6355a0ffa2250ba01f71..7708c57bdc907adc6e1bd86ce7d819b46c8603b7 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 b7bfbe7f935b74c46a795dd5370c814e4f5350c4..2b7a3be4b84c0d5d02a0389d74f8447ea7d02b97 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); } };