From ce506930c39c070105ca7861459764bd6cff6984 Mon Sep 17 00:00:00 2001 From: lilong12 Date: Thu, 30 Jul 2020 20:03:54 +0800 Subject: [PATCH] Fix the bug that Input(Offsets) and attr(offsets) cannot be set at the same time. (#24975) * bug fix, test=develop --- paddle/fluid/operators/crop_tensor_op.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/paddle/fluid/operators/crop_tensor_op.h b/paddle/fluid/operators/crop_tensor_op.h index 7fbcd52715..58960465b9 100644 --- a/paddle/fluid/operators/crop_tensor_op.h +++ b/paddle/fluid/operators/crop_tensor_op.h @@ -132,11 +132,6 @@ static std::vector GetOffsets(const framework::ExecutionContext& ctx) { } if (ctx.HasInput("Offsets")) { - PADDLE_ENFORCE_EQ( - ctx.Attr>("offsets").empty(), true, - platform::errors::InvalidArgument( - "Input 'Offsets' and attribute 'offsets' for Op(crop_tensor) " - "cannot be used at the same time.")); const auto* offsets_tensor = ctx.Input("Offsets"); PADDLE_ENFORCE_EQ(offsets_tensor->dims().size(), 1, platform::errors::InvalidArgument( @@ -149,6 +144,7 @@ static std::vector GetOffsets(const framework::ExecutionContext& ctx) { "input 'Offsets' must be equal to " "the number of dimensions (%d) of the input tensor.", offsets_tensor->dims()[0], rank)); + const int* offsets_data; framework::Tensor cpu_tmp_tensor; if (platform::is_cpu_place(offsets_tensor->place())) { -- GitLab