diff --git a/src/framework/loader.cpp b/src/framework/loader.cpp index eb07e9f6155370880f6fb8e302a8e396df17954d..5587d0698fa2b9a04532deae618545d15ecd631f 100644 --- a/src/framework/loader.cpp +++ b/src/framework/loader.cpp @@ -44,7 +44,12 @@ void Loader::InitMemoryFromProgram( } else { auto dim = var_desc->Tensor_desc().Dims(); PADDLE_MOBILE_ENFORCE(dim.size() > 0, "dim size is 0"); - dim[0] = 1; + // dim[0] = 1; + for (auto &d : dim) { + if (d < 0) { + d *= -1; + } + } auto tensor = var->GetMutable(); tensor->Resize(make_ddim(dim)); }