提交 325fef46 编写于 作者: E eclipsess

add case in loader: dim[2] < 0

上级 7a4806d5
...@@ -44,7 +44,12 @@ void Loader<Dtype, P>::InitMemoryFromProgram( ...@@ -44,7 +44,12 @@ void Loader<Dtype, P>::InitMemoryFromProgram(
} else { } else {
auto dim = var_desc->Tensor_desc().Dims(); auto dim = var_desc->Tensor_desc().Dims();
PADDLE_MOBILE_ENFORCE(dim.size() > 0, "dim size is 0"); 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<LoDTensor>(); auto tensor = var->GetMutable<LoDTensor>();
tensor->Resize(make_ddim(dim)); tensor->Resize(make_ddim(dim));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册