From d0056c324d6e5deba41fafb0d0cf5b6a144b63bf Mon Sep 17 00:00:00 2001 From: 123malin Date: Thu, 31 Dec 2020 15:40:25 +0800 Subject: [PATCH] test=develop, add op_register_version for roll_op (#30023) * test=develop, add op_register_version for roll_op --- paddle/fluid/operators/roll_op.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/operators/roll_op.cc b/paddle/fluid/operators/roll_op.cc index 975cf83ffe..b1fe952036 100644 --- a/paddle/fluid/operators/roll_op.cc +++ b/paddle/fluid/operators/roll_op.cc @@ -13,9 +13,9 @@ // limitations under the License. #include "paddle/fluid/operators/roll_op.h" - #include #include +#include "paddle/fluid/framework/op_version_registry.h" namespace paddle { namespace operators { @@ -142,3 +142,17 @@ REGISTER_OP_CPU_KERNEL( ops::RollGradKernel, ops::RollGradKernel, ops::RollGradKernel); + +REGISTER_OP_VERSION(roll) + .AddCheckpoint( + R"ROC( + Upgrade roll add 1 attribute [axis], delete 1 attribute[dims]. + )ROC", + paddle::framework::compatible::OpVersionDesc() + .NewAttr("axis", + "(std::vector) Axis along which to roll. " + "It must have the same size with shifts.", + std::vector()) + .DeleteAttr("dims", + "(std::vector) Dims along which to roll. " + "It must have the same size with shifts.")); -- GitLab