From d61dbfc8f04515a8d75a884f854bfd76109ffcec Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=98=A4=ED=98=95=EC=84=9D/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 2 Sep 2019 15:54:24 +0900 Subject: [PATCH] Fix uninitialized field (#7089) Fix uninitialized field contructor warning in neurun core and backend Signed-off-by: Hyeongseok Oh --- runtimes/neurun/backend/acl_cl/KernelGenerator.cc | 2 +- runtimes/neurun/backend/acl_neon/KernelGenerator.cc | 2 +- runtimes/neurun/backend/cpu/KernelGenerator.cc | 3 ++- runtimes/neurun/backend/cpu/kernel/PermuteLayer.h | 8 ++++---- runtimes/neurun/core/include/graph/operand/PermuteFactor.h | 4 ++-- runtimes/neurun/core/src/compiler/OperationValidator.h | 5 ++++- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/runtimes/neurun/backend/acl_cl/KernelGenerator.cc b/runtimes/neurun/backend/acl_cl/KernelGenerator.cc index 2b0d901..05f3600 100644 --- a/runtimes/neurun/backend/acl_cl/KernelGenerator.cc +++ b/runtimes/neurun/backend/acl_cl/KernelGenerator.cc @@ -147,7 +147,7 @@ void ActivationBuilder::append(model::Activation code, ::arm_compute::ICLTensor // KernelGenerator::KernelGenerator(const neurun::model::Operands &ctx, const std::shared_ptr &tensor_builder) - : _ctx(ctx), _tensor_builder(tensor_builder) + : _ctx(ctx), _tensor_builder(tensor_builder), _current_subg_layout(model::Layout::UNKNOWN) { // DO NOTHING } diff --git a/runtimes/neurun/backend/acl_neon/KernelGenerator.cc b/runtimes/neurun/backend/acl_neon/KernelGenerator.cc index be93fed..d2cd2e5 100644 --- a/runtimes/neurun/backend/acl_neon/KernelGenerator.cc +++ b/runtimes/neurun/backend/acl_neon/KernelGenerator.cc @@ -158,7 +158,7 @@ void ActivationBuilder::append(model::Activation act, ::arm_compute::ITensor *if // KernelGenerator::KernelGenerator(const neurun::model::Operands &ctx, const std::shared_ptr &tensor_builder) - : _ctx(ctx), _tensor_builder(tensor_builder) + : _ctx(ctx), _tensor_builder(tensor_builder), _current_subg_layout(model::Layout::UNKNOWN) { // DO NOTHING } diff --git a/runtimes/neurun/backend/cpu/KernelGenerator.cc b/runtimes/neurun/backend/cpu/KernelGenerator.cc index b7ce8a2..f92e5dc 100644 --- a/runtimes/neurun/backend/cpu/KernelGenerator.cc +++ b/runtimes/neurun/backend/cpu/KernelGenerator.cc @@ -49,7 +49,8 @@ namespace cpu KernelGenerator::KernelGenerator(const neurun::model::Operands &operand_ctx, const std::shared_ptr &tensor_builder, const std::shared_ptr &kernel_registry) - : _ctx(operand_ctx), _tensor_builder(tensor_builder), _kernel_registry(kernel_registry) + : _ctx(operand_ctx), _tensor_builder(tensor_builder), _kernel_registry(kernel_registry), + _current_subg_layout(model::Layout::UNKNOWN) { // DO NOTHING } diff --git a/runtimes/neurun/backend/cpu/kernel/PermuteLayer.h b/runtimes/neurun/backend/cpu/kernel/PermuteLayer.h index a3cca0c..3acb2cc 100644 --- a/runtimes/neurun/backend/cpu/kernel/PermuteLayer.h +++ b/runtimes/neurun/backend/cpu/kernel/PermuteLayer.h @@ -196,11 +196,11 @@ private: } private: - std::shared_ptr<::neurun::backend::operand::IObject> _input; - std::shared_ptr<::neurun::backend::operand::IObject> _output; - model::Shape _output_shape; + std::shared_ptr<::neurun::backend::operand::IObject> _input{nullptr}; + std::shared_ptr<::neurun::backend::operand::IObject> _output{nullptr}; + model::Shape _output_shape{}; model::operation::PermuteNode::Type _type{model::operation::PermuteNode::Type::COPY}; - model::DataType _dataType; + model::DataType _dataType{model::DataType::FLOAT32}; }; } // namespace kernel diff --git a/runtimes/neurun/core/include/graph/operand/PermuteFactor.h b/runtimes/neurun/core/include/graph/operand/PermuteFactor.h index da9a8c1..8e69892 100644 --- a/runtimes/neurun/core/include/graph/operand/PermuteFactor.h +++ b/runtimes/neurun/core/include/graph/operand/PermuteFactor.h @@ -99,8 +99,8 @@ public: bool operator!=(const PermuteFactor &other) const { return !(*this == other); } private: - const backend::Backend *_backend; - model::Layout _layout; + const backend::Backend *_backend{nullptr}; + model::Layout _layout{model::Layout::UNKNOWN}; }; } // namespace operand diff --git a/runtimes/neurun/core/src/compiler/OperationValidator.h b/runtimes/neurun/core/src/compiler/OperationValidator.h index 96dc1b8..f9a96a3 100644 --- a/runtimes/neurun/core/src/compiler/OperationValidator.h +++ b/runtimes/neurun/core/src/compiler/OperationValidator.h @@ -36,7 +36,10 @@ namespace compiler class OperationValidator : public model::OperationVisitor { public: - OperationValidator(const neurun::model::Operands &ctx) : _ctx{ctx} {} + OperationValidator(const neurun::model::Operands &ctx) + : _ctx{ctx}, _current_subg_layout{model::Layout::UNKNOWN} + { + } public: void visit(const model::Subgraph &node) override; -- 2.7.4