From bb0fdd16166f34d6fd2b3bba6c7eadb841377ae8 Mon Sep 17 00:00:00 2001 From: Yan Chunwei Date: Wed, 5 Jun 2019 16:09:27 +0800 Subject: [PATCH] fix lite compile (#17858) * fix lite compile test=develop * update test=develop --- paddle/fluid/lite/core/hvy_tensor.h | 1 + paddle/fluid/lite/core/lite_tensor.h | 1 + paddle/fluid/lite/model_parser/CMakeLists.txt | 2 +- paddle/fluid/lite/model_parser/pb/CMakeLists.txt | 1 - paddle/fluid/lite/operators/concat_op.cc | 4 ++-- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/lite/core/hvy_tensor.h b/paddle/fluid/lite/core/hvy_tensor.h index 7c60e1661ce..f86ca272921 100644 --- a/paddle/fluid/lite/core/hvy_tensor.h +++ b/paddle/fluid/lite/core/hvy_tensor.h @@ -39,6 +39,7 @@ class DDimHvy : public DDimBase { } value_type operator[](int offset) const { return data_[offset]; } + value_type& operator[](int offset) { return data_[offset]; } std::vector Vectorize() const { return framework::vectorize(data_); } diff --git a/paddle/fluid/lite/core/lite_tensor.h b/paddle/fluid/lite/core/lite_tensor.h index 24f28300d05..79f1352cb06 100644 --- a/paddle/fluid/lite/core/lite_tensor.h +++ b/paddle/fluid/lite/core/lite_tensor.h @@ -37,6 +37,7 @@ class DDimLite : public DDimBase { void ConstructFrom(const std::vector &x) { data_ = x; } value_type operator[](int offset) const { return data_[offset]; } + value_type &operator[](int offset) { return data_[offset]; } std::vector Vectorize() const { return data_; } size_t size() const { return data_.size(); } diff --git a/paddle/fluid/lite/model_parser/CMakeLists.txt b/paddle/fluid/lite/model_parser/CMakeLists.txt index a284f0388fa..63fe21abdaf 100644 --- a/paddle/fluid/lite/model_parser/CMakeLists.txt +++ b/paddle/fluid/lite/model_parser/CMakeLists.txt @@ -23,7 +23,7 @@ if (LITE_WITH_CUDA) endif() cc_library(model_parser_lite SRCS model_parser.cc DEPS ${model_parser_deps}) -cc_test(test_op_desc_lite SRCS op_desc_test.cc DEPS cpp_op_desc_lite any_lite op_desc_lite compatible_pb_lite) +lite_cc_test(test_op_desc_lite SRCS op_desc_test.cc DEPS cpp_op_desc_lite op_desc_lite compatible_pb_lite) add_subdirectory(pb) add_subdirectory(cpp) diff --git a/paddle/fluid/lite/model_parser/pb/CMakeLists.txt b/paddle/fluid/lite/model_parser/pb/CMakeLists.txt index 6910542f2a1..22d88aeabf4 100644 --- a/paddle/fluid/lite/model_parser/pb/CMakeLists.txt +++ b/paddle/fluid/lite/model_parser/pb/CMakeLists.txt @@ -1,3 +1,2 @@ cc_library(var_desc_lite SRCS var_desc.cc DEPS framework_proto_lite) cc_library(op_desc_lite SRCS op_desc.cc DEPS framework_proto_lite) - diff --git a/paddle/fluid/lite/operators/concat_op.cc b/paddle/fluid/lite/operators/concat_op.cc index e9b773ceebd..e51d6e0d349 100644 --- a/paddle/fluid/lite/operators/concat_op.cc +++ b/paddle/fluid/lite/operators/concat_op.cc @@ -27,9 +27,9 @@ bool ConcatOpLite::CheckShape() const { } bool ConcatOpLite::InferShape() const { - std::vector input_dims; + std::vector input_dims; for (auto p : param_.x) { - input_dims.push_back(p->dims().data()); + input_dims.push_back(p->dims()); } size_t axis = static_cast(param_.axis); const size_t n = input_dims.size(); -- GitLab