From 48fe9b05beb3f0688cf88b9fceb277d742921f67 Mon Sep 17 00:00:00 2001 From: liuruilong Date: Mon, 28 May 2018 15:00:13 +0800 Subject: [PATCH] add resize output tensor --- src/io.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/io.cpp b/src/io.cpp index d2aa9cd62a..0b02073b5a 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -205,8 +205,13 @@ const framework::Program Loader::Load( var_desc->Type() != framework::VARTYPE_TYPE_FETCH_LIST) { // DLOG << "to load var "; LoadVar(var, *var_desc, dirname + "/" + var_desc->Name()); + } else { + auto dim = var_desc->Tensor_desc().Dims(); + PADDLE_MOBILE_ENFORCE(dim.size() > 0, "dim size is 0"); + dim[0] = 1; + auto tensor = var->GetMutable(); + tensor->Resize(framework::make_ddim(dim)); } - } else { // TODO(codeWorm): some. } -- GitLab