From 0328da9c24ec1822b7b6e427180fcaed0410573c 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 7c60e1661c..f86ca27292 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 24f28300d0..79f1352cb0 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 a284f0388f..63fe21abda 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 6910542f2a..22d88aeabf 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 e9b773ceeb..e51d6e0d34 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