From 8e6e47dfcaf306512d50d79ed3017087249d3d95 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=D0=94=D0=B8=D0=BB=D1=88=D0=BE=D0=B4=D0=B6=D0=BE=D0=BD=20?= =?utf8?q?=D0=A3=D0=BC=D1=80=D0=BE=D0=BD=D1=85=D0=BE=D0=BD=D0=BE=D0=B2?= =?utf8?q?=D0=B8=D1=87=20=D0=9F=D0=BE=D1=88=D1=88=D0=BE=D0=B5=D0=B2/AI=20T?= =?utf8?q?ools=20Lab=20/SRR/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Thu, 31 Jan 2019 18:52:16 +0300 Subject: [PATCH] [nnc] Fix svace error (#2982) Fixed "Major" and "Critical" errors of svace Signed-off-by: Dilshodzhon Poshshoev --- contrib/nnc/include/ADT/SmallVector.h | 4 ++-- contrib/nnc/passes/interpreter/interpreter_pass.cpp | 2 +- contrib/nnc/passes/soft_backend/SequencedIR.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/nnc/include/ADT/SmallVector.h b/contrib/nnc/include/ADT/SmallVector.h index 3f09ad7..17fb565 100644 --- a/contrib/nnc/include/ADT/SmallVector.h +++ b/contrib/nnc/include/ADT/SmallVector.h @@ -86,7 +86,7 @@ public: * @return reference to the element at position idx */ inline reference operator[](size_t idx) noexcept { - assert(idx >= 0 && idx < _size); + assert(idx < _size); return _storage[idx]; } @@ -95,7 +95,7 @@ public: */ inline constexpr value_type operator[](size_t idx) const noexcept { //assert on the same line since c++11 does not allow multi-line constexpr functions - return assert(idx >= 0 && idx < _size), _storage[idx]; + return assert(idx < _size), _storage[idx]; } inline iterator begin() noexcept { diff --git a/contrib/nnc/passes/interpreter/interpreter_pass.cpp b/contrib/nnc/passes/interpreter/interpreter_pass.cpp index a8edcd5..aab24e9 100644 --- a/contrib/nnc/passes/interpreter/interpreter_pass.cpp +++ b/contrib/nnc/passes/interpreter/interpreter_pass.cpp @@ -63,7 +63,7 @@ static void writeTensorToHDF5File(const TensorVariant& tensor, const int32_t rank = shape.rank(); hsize_t dims[rank]; for (int32_t axis = 0; axis < rank; ++axis) { - dims[axis] = shape.dim(axis); + dims[axis] = static_cast(shape.dim(axis)); } // Create float array from tensor diff --git a/contrib/nnc/passes/soft_backend/SequencedIR.h b/contrib/nnc/passes/soft_backend/SequencedIR.h index f27f02f..4db16b2 100644 --- a/contrib/nnc/passes/soft_backend/SequencedIR.h +++ b/contrib/nnc/passes/soft_backend/SequencedIR.h @@ -121,7 +121,7 @@ struct CallFunction : public Action { outputs(outputs), paramStartOffset(0) {} - CallFunction() : Action(Type::callFunction) {} + CallFunction() : Action(Type::callFunction), mirOp(nullptr), paramStartOffset(0) {} mir::Operation* mirOp; std::string funcName; -- 2.7.4