diff --git a/src/io.cpp b/src/io.cpp index bf632cf1db3031da4d0ceae915cf3cdddc7193a4..eaab40b519fa566627dc31571e3d246d52747004 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -224,6 +224,18 @@ const framework::Program Loader::Load( } for (const auto &var : block.vars()) { + if (var.type().type() == framework::proto::VarType::LOD_TENSOR) { + LOG(kLOG_DEBUG1) << "var name: " << var.name(); + const framework::proto::VarType::TensorDesc &tensor_desc = + var.type().lod_tensor().tensor(); + LOG(kLOG_DEBUG2) << "in var tensor desc dims size: " + << tensor_desc.dims().size(); + for (int l = 0; l < tensor_desc.dims().size(); ++l) { + LOG(kLOG_DEBUG3) << "var tensor desc dim " << l + << " value: " << tensor_desc.dims()[l]; + } + } + if (var.persistable() && var.type().type() != framework::proto::VarType::FEED_MINIBATCH && var.type().type() != framework::proto::VarType::FETCH_LIST) { diff --git a/test/operators/test_cov_op.cpp b/test/operators/test_cov_op.cpp index a1fc543a4a10da1b2ecbe0980869876dbb1b604e..260cdfa04c496c0d9671708a7e4dacabea135f9d 100644 --- a/test/operators/test_cov_op.cpp +++ b/test/operators/test_cov_op.cpp @@ -28,9 +28,9 @@ int main() { executor(program, "conv2d"); paddle_mobile::framework::Tensor input; - SetupTensor(&input, {1, 3, 32, 32}, static_cast(0), - static_cast(1)); - auto out_ddim = paddle_mobile::framework::make_ddim({1, 64, 56, 56}); + GetInput(g_test_image_1x3x224x224, &input, {1, 3, 224, 224}); + + auto out_ddim = paddle_mobile::framework::make_ddim({1, 64, 112, 112}); auto output = executor.predict(input, "data", "conv2d_0.tmp_0", out_ddim); auto output_ptr = output->data(); diff --git a/test/test_helper.h b/test/test_helper.h index c4a6565bd248c7b7c6d70bc58a108d6f6a68150e..3f298c5908293163aa0d25a209d146e04ff74068 100644 --- a/test/test_helper.h +++ b/test/test_helper.h @@ -60,3 +60,14 @@ void GetInput(const std::string &input_name, std::vector *input, } free(input_ptr); } + +template +void GetInput(const std::string &input_name, paddle_mobile::framework::Tensor *input, + paddle_mobile::framework::DDim dims) { + + T *input_ptr = input->mutable_data(dims); + + std::ifstream in(input_name, std::ios::in | std::ios::binary); + in.read((char *)(input_ptr), input->numel() * sizeof(T)); + in.close(); +}