未验证 提交 ce506930 编写于 作者: L lilong12 提交者: GitHub

Fix the bug that Input(Offsets) and attr(offsets) cannot be set at the same time. (#24975)

* bug fix, test=develop
上级 8a68d2c2
...@@ -132,11 +132,6 @@ static std::vector<int> GetOffsets(const framework::ExecutionContext& ctx) { ...@@ -132,11 +132,6 @@ static std::vector<int> GetOffsets(const framework::ExecutionContext& ctx) {
} }
if (ctx.HasInput("Offsets")) { if (ctx.HasInput("Offsets")) {
PADDLE_ENFORCE_EQ(
ctx.Attr<std::vector<int>>("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<Tensor>("Offsets"); const auto* offsets_tensor = ctx.Input<Tensor>("Offsets");
PADDLE_ENFORCE_EQ(offsets_tensor->dims().size(), 1, PADDLE_ENFORCE_EQ(offsets_tensor->dims().size(), 1,
platform::errors::InvalidArgument( platform::errors::InvalidArgument(
...@@ -149,6 +144,7 @@ static std::vector<int> GetOffsets(const framework::ExecutionContext& ctx) { ...@@ -149,6 +144,7 @@ static std::vector<int> GetOffsets(const framework::ExecutionContext& ctx) {
"input 'Offsets' must be equal to " "input 'Offsets' must be equal to "
"the number of dimensions (%d) of the input tensor.", "the number of dimensions (%d) of the input tensor.",
offsets_tensor->dims()[0], rank)); offsets_tensor->dims()[0], rank));
const int* offsets_data; const int* offsets_data;
framework::Tensor cpu_tmp_tensor; framework::Tensor cpu_tmp_tensor;
if (platform::is_cpu_place(offsets_tensor->place())) { if (platform::is_cpu_place(offsets_tensor->place())) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册