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

* bug fix, test=develop
fix_copy_if_different
lilong12 5 years ago committed by GitHub
parent 8a68d2c213
commit ce506930c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -132,11 +132,6 @@ static std::vector<int> GetOffsets(const framework::ExecutionContext& ctx) {
}
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");
PADDLE_ENFORCE_EQ(offsets_tensor->dims().size(), 1,
platform::errors::InvalidArgument(
@ -149,6 +144,7 @@ static std::vector<int> 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())) {

Loading…
Cancel
Save