未验证 提交 c7049ee4 编写于 作者: X xiebaiyuan 提交者: GitHub

[mobile] wrap_shape in mobile loader. (#3442)

ONLY FIX MOBILE FOR OLD PROJECT ,DONOT NEED CHECK LITE COMPILE >>> MREGE DIRECT
上级 b3467a55
......@@ -75,7 +75,17 @@ void Loader<GPU_CL, float>::InitMemoryFromProgram(
} else {
auto dim = var_desc->Tensor_desc().Dims();
PADDLE_MOBILE_ENFORCE(dim.size() > 0, "dim size is 0");
dim[0] = 1;
if (dim.size() == 0) {
auto tensor = var->GetMutable<LoDTensor>();
framework::DDim dDim = {0};
tensor->Resize(dDim);
} else {
for (auto &d : dim) {
if (d < 0) {
d *= -1;
}
}
}
auto cl_image = var->GetMutable<framework::CLImage>();
cl_image->Resize(make_ddim(dim));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册