diff options
author | Сергей Баранников/AI Tools Lab /SRR/Engineer/삼성전자 <s.barannikov@samsung.com> | 2019-08-01 21:11:53 +0300 |
---|---|---|
committer | Efimov Alexander/AI Tools Lab/./Samsung Electronics <a.efimov@samsung.com> | 2019-08-01 21:11:53 +0300 |
commit | 0d173e13318f801ec1991f41263aa6456a051349 (patch) | |
tree | b1f3f1ccc6b14345e3fcc02fd93fee4e1f909db3 /compiler/nnc | |
parent | d53495a7397d71c17550db9666070ce3cbf85892 (diff) | |
download | nnfw-0d173e13318f801ec1991f41263aa6456a051349.tar.gz nnfw-0d173e13318f801ec1991f41263aa6456a051349.tar.bz2 nnfw-0d173e13318f801ec1991f41263aa6456a051349.zip |
[nnc] Support 0-dimensional tensors in x86-c++ backend (#6121)
Fixes compilation error of TFLIte StyleTransfer nework.
Signed-off-by: Sergei Barannikov <s.barannikov@samsung.com>
Diffstat (limited to 'compiler/nnc')
-rw-r--r-- | compiler/nnc/passes/soft_backend/code_snippets/cpp_header_types.def | 6 | ||||
-rw-r--r-- | compiler/nnc/unittests/soft_backend/CPPHeaderTypes.cpp | 2 |
2 files changed, 2 insertions, 6 deletions
diff --git a/compiler/nnc/passes/soft_backend/code_snippets/cpp_header_types.def b/compiler/nnc/passes/soft_backend/code_snippets/cpp_header_types.def index 77efd9ad8..771329cdd 100644 --- a/compiler/nnc/passes/soft_backend/code_snippets/cpp_header_types.def +++ b/compiler/nnc/passes/soft_backend/code_snippets/cpp_header_types.def @@ -92,10 +92,6 @@ public: /** Returns number of elements in table*/ index_t getNumElems() const { - if (_dims == 0) - { - return 0; - } index_t volume = 1; for (index_t i = 0; i < _dims; ++i) { @@ -120,7 +116,7 @@ using Index = Shape; class Tensor { public: - Tensor(): _shape(), _data(nullptr), _managed(true){} + Tensor(): Tensor(Shape{}){} Tensor(Tensor &&orig): _shape(orig._shape), _data(orig._data), _managed(orig._managed) { diff --git a/compiler/nnc/unittests/soft_backend/CPPHeaderTypes.cpp b/compiler/nnc/unittests/soft_backend/CPPHeaderTypes.cpp index f474664d8..bd81d565d 100644 --- a/compiler/nnc/unittests/soft_backend/CPPHeaderTypes.cpp +++ b/compiler/nnc/unittests/soft_backend/CPPHeaderTypes.cpp @@ -64,7 +64,7 @@ TEST(SOFT_BACKEND, shape_and_index) { TEST(SOFT_BACKEND, tensor) { // test reshape Tensor t1; - ASSERT_EQ(t1.getShape().getNumElems(), 0); + ASSERT_EQ(t1.getShape().getNumElems(), 1); const index_t tensor1_height = 2; const index_t tensor1_width = 4; t1.reshape(Shape{tensor1_height, tensor1_width}); |