From 1b999d2b5d0d898138e38d020c95aae295c18897 Mon Sep 17 00:00:00 2001 From: whs Date: Mon, 4 Jan 2021 13:49:41 +0800 Subject: [PATCH] Add version checking (#30040) --- paddle/fluid/operators/affine_grid_op.cc | 9 +++++++++ .../detection/generate_proposal_labels_op.cc | 14 ++++++++++++++ paddle/fluid/operators/gaussian_random_op.cc | 8 ++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/operators/affine_grid_op.cc b/paddle/fluid/operators/affine_grid_op.cc index d1a3695015a..675baa67682 100644 --- a/paddle/fluid/operators/affine_grid_op.cc +++ b/paddle/fluid/operators/affine_grid_op.cc @@ -17,6 +17,7 @@ limitations under the License. */ #include #include #include "paddle/fluid/framework/op_registry.h" +#include "paddle/fluid/framework/op_version_registry.h" #ifdef PADDLE_WITH_CUDA #include "paddle/fluid/platform/cudnn_helper.h" #endif @@ -271,3 +272,11 @@ REGISTER_OP_CPU_KERNEL( affine_grid_grad, ops::AffineGridGradOpKernel, ops::AffineGridGradOpKernel); + +REGISTER_OP_VERSION(affine_grid) + .AddCheckpoint( + R"ROC( + Compatible upgrade of affine_grid, add a new attribute [align_corners])ROC", + paddle::framework::compatible::OpVersionDesc().NewAttr( + "align_corners", + "Whether to align the corners of input and output.", true)); diff --git a/paddle/fluid/operators/detection/generate_proposal_labels_op.cc b/paddle/fluid/operators/detection/generate_proposal_labels_op.cc index 0b8fcbb7427..1b1fa7b064f 100644 --- a/paddle/fluid/operators/detection/generate_proposal_labels_op.cc +++ b/paddle/fluid/operators/detection/generate_proposal_labels_op.cc @@ -14,6 +14,7 @@ limitations under the License. */ #include #include #include "paddle/fluid/framework/op_registry.h" +#include "paddle/fluid/framework/op_version_registry.h" #include "paddle/fluid/operators/detection/bbox_util.h" #include "paddle/fluid/operators/gather.h" #include "paddle/fluid/operators/math/concat_and_split.h" @@ -713,3 +714,16 @@ REGISTER_OPERATOR( REGISTER_OP_CPU_KERNEL(generate_proposal_labels, ops::GenerateProposalLabelsKernel, ops::GenerateProposalLabelsKernel); + +REGISTER_OP_VERSION(generate_proposal_labels) + .AddCheckpoint( + R"ROC( + Upgrade of output [MaxOverlapWithGT])ROC", + paddle::framework::compatible::OpVersionDesc().NewOutput( + "MaxOverlapWithGT", + "The maxoverlap between output RoIs and ground-truth.")) + .AddCheckpoint( + R"ROC( + Upgrade generate_proposal_labels add a new input [MaxOverlap])ROC", + paddle::framework::compatible::OpVersionDesc().NewInput( + "MaxOverlap", "MaxOverlap is dispensable.")); diff --git a/paddle/fluid/operators/gaussian_random_op.cc b/paddle/fluid/operators/gaussian_random_op.cc index 840975f754f..9087a9e8d5c 100644 --- a/paddle/fluid/operators/gaussian_random_op.cc +++ b/paddle/fluid/operators/gaussian_random_op.cc @@ -210,7 +210,7 @@ REGISTER_OP_VERSION(gaussian_random) .NewInput("ShapeTensorList", "The output shape supports list filled with Tensor. " "ShapeTensorList is dispensable.") - .ModifyAttr( - "shape", - "Add the default value of shape, the default value is {}.", - {})); + .ModifyAttr("shape", + "The arg 'default_value' of attr 'shape' is changed: " + "from 'None' to '{}'.", + std::vector{})); -- GitLab