summaryrefslogtreecommitdiff
path: root/libs/misc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/misc')
-rw-r--r--libs/misc/CMakeLists.txt13
-rw-r--r--libs/misc/examples/tensor_index_iterator.cpp74
-rw-r--r--libs/misc/include/misc/EnvVar.h107
-rw-r--r--libs/misc/include/misc/benchmark.h87
-rw-r--r--libs/misc/include/misc/environment.h130
-rw-r--r--libs/misc/include/misc/feature/Index.h137
-rw-r--r--libs/misc/include/misc/feature/IndexIterator.h105
-rw-r--r--libs/misc/include/misc/feature/Object.h117
-rw-r--r--libs/misc/include/misc/feature/Reader.h69
-rw-r--r--libs/misc/include/misc/feature/Shape.h77
-rw-r--r--libs/misc/include/misc/feature/TextFormatter.h116
-rw-r--r--libs/misc/include/misc/fp32.h99
-rw-r--r--libs/misc/include/misc/kernel/IndexIterator.h102
-rw-r--r--libs/misc/include/misc/kernel/RandomObject.h77
-rw-r--r--libs/misc/include/misc/kernel/Reader.h60
-rw-r--r--libs/misc/include/misc/kernel/Shape.h68
-rw-r--r--libs/misc/include/misc/matrix/IndexIterator.h99
-rw-r--r--libs/misc/include/misc/matrix/Reader.h59
-rw-r--r--libs/misc/include/misc/matrix/Shape.h63
-rw-r--r--libs/misc/include/misc/tensor/Comparator.h95
-rw-r--r--libs/misc/include/misc/tensor/Diff.h70
-rw-r--r--libs/misc/include/misc/tensor/Index.h105
-rw-r--r--libs/misc/include/misc/tensor/IndexEnumerator.h131
-rw-r--r--libs/misc/include/misc/tensor/IndexFormatter.h75
-rw-r--r--libs/misc/include/misc/tensor/IndexIterator.h107
-rw-r--r--libs/misc/include/misc/tensor/NonIncreasingStride.h83
-rw-r--r--libs/misc/include/misc/tensor/Object.h100
-rw-r--r--libs/misc/include/misc/tensor/Reader.h58
-rw-r--r--libs/misc/include/misc/tensor/Shape.h152
-rw-r--r--libs/misc/include/misc/tensor/Zipper.h104
-rw-r--r--libs/misc/include/misc/vector.h52
-rw-r--r--libs/misc/include/misc/vector/Object.h92
-rw-r--r--libs/misc/include/misc/vector/Reader.h58
-rw-r--r--libs/misc/src/environment.cpp95
-rw-r--r--libs/misc/src/tensor/Comparator.cpp40
-rw-r--r--libs/misc/src/tensor/IndexFormatter.cpp49
-rw-r--r--libs/misc/src/tensor/NonIncreasingStride.cpp46
-rw-r--r--libs/misc/src/tensor/Shape.cpp99
38 files changed, 0 insertions, 3270 deletions
diff --git a/libs/misc/CMakeLists.txt b/libs/misc/CMakeLists.txt
deleted file mode 100644
index cd01695fb..000000000
--- a/libs/misc/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-# Library `nnfw_lib_misc`
-set(NNFW_UTILITY_SRCS src/environment.cpp)
-list(APPEND NNFW_UTILITY_SRCS src/tensor/Shape.cpp)
-list(APPEND NNFW_UTILITY_SRCS src/tensor/NonIncreasingStride.cpp)
-list(APPEND NNFW_UTILITY_SRCS src/tensor/IndexFormatter.cpp)
-list(APPEND NNFW_UTILITY_SRCS src/tensor/Comparator.cpp)
-
-add_library(nnfw_lib_misc STATIC ${NNFW_UTILITY_SRCS})
-target_include_directories(nnfw_lib_misc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
-set_target_properties(nnfw_lib_misc PROPERTIES POSITION_INDEPENDENT_CODE ON)
-
-add_executable(nnfw_tensor_index_iterator "examples/tensor_index_iterator.cpp")
-target_link_libraries(nnfw_tensor_index_iterator nnfw_lib_misc)
diff --git a/libs/misc/examples/tensor_index_iterator.cpp b/libs/misc/examples/tensor_index_iterator.cpp
deleted file mode 100644
index 8a19dac87..000000000
--- a/libs/misc/examples/tensor_index_iterator.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "misc/tensor/IndexIterator.h"
-
-#include <array>
-
-#include <iostream>
-#include <algorithm>
-
-#include <cassert>
-
-void test_iterate(void)
-{
- const nnfw::misc::tensor::Shape shape{3, 4, 7};
-
- std::array<int, 3 * 4 * 7> array;
-
- array.fill(0);
-
- using nnfw::misc::tensor::iterate;
- using nnfw::misc::tensor::Index;
-
- iterate(shape) << [&](const Index &index) {
- assert(index.rank() == shape.rank());
-
- const size_t rank = index.rank();
-
- uint32_t offset = index.at(0);
-
- for (size_t axis = 1; axis < rank; ++axis)
- {
- offset *= shape.dim(axis);
- offset += index.at(axis);
- }
-
- array[offset] += 1;
- };
-
- assert(std::all_of(array.begin(), array.end(), [](int num) { return num == 1; }));
-}
-
-int main(int argc, char **argv)
-{
- test_iterate();
-
- nnfw::misc::tensor::Shape shape{3, 4, 3, 4};
-
- std::cout << "Iterate over tensor{3, 4, 3, 4}" << std::endl;
-
- nnfw::misc::tensor::iterate(shape) << [](const nnfw::misc::tensor::Index &index) {
- std::cout << "rank: " << index.rank() << std::endl;
-
- for (size_t d = 0; d < index.rank(); ++d)
- {
- std::cout << " offset(" << d << ") = " << index.at(d) << std::endl;
- }
- };
-
- return 0;
-}
diff --git a/libs/misc/include/misc/EnvVar.h b/libs/misc/include/misc/EnvVar.h
deleted file mode 100644
index 47206d4c0..000000000
--- a/libs/misc/include/misc/EnvVar.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file EnvVar.h
- * @ingroup COM_AI_RUNTIME
- * @brief This file contains nnfw::misc::EnvVar class
- */
-
-#ifndef __NNFW_MISC_ENV_VAR__
-#define __NNFW_MISC_ENV_VAR__
-
-#include <algorithm>
-#include <array>
-#include <cstdlib>
-#include <string>
-
-namespace nnfw
-{
-namespace misc
-{
-/**
- * @brief Class to access environment variable
- */
-class EnvVar
-{
-public:
- /**
- * @brief Construct a new EnvVar object
- * @param[in] key environment variable
- */
- EnvVar(const std::string &key)
- {
- const char *value = std::getenv(key.c_str());
- if (value == nullptr)
- {
- // An empty string is considered as an empty value
- _value = "";
- }
- else
- {
- _value = value;
- }
- }
-
- /**
- * @brief Get environment variable of string type
- * @param[in] def Default value of environment variable
- * @return Defaut value passed as a parameter when there is no environment variable,
- * otherwise the value of environment variable passed into constructor
- */
- std::string asString(const std::string &def) const
- {
- if (_value.empty())
- return def;
- return _value;
- }
-
- /**
- * @brief Get environment variable of boolean type
- * @param[in] def Default value of environment variable
- * @return Defaut value passed as a parameter when there is no environment variable,
- * otherwise the value of environment variable passed into constructor
- */
- bool asBool(bool def) const
- {
- if (_value.empty())
- return def;
- static const std::array<std::string, 5> false_list{"0", "OFF", "FALSE", "N", "NO"};
- auto false_found = std::find(false_list.begin(), false_list.end(), _value);
- return (false_found == false_list.end());
- }
-
- /**
- * @brief Get environment variable of int type
- * @param[in] def Default value of environment variable
- * @return Defaut value passed as a parameter when there is no environment variable,
- * otherwise the value of environment variable passed into constructor
- */
- int asInt(int def) const
- {
- if (_value.empty())
- return def;
- return std::stoi(_value);
- }
-
-private:
- std::string _value;
-};
-
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_ENV_VAR__
diff --git a/libs/misc/include/misc/benchmark.h b/libs/misc/include/misc/benchmark.h
deleted file mode 100644
index fe5b97585..000000000
--- a/libs/misc/include/misc/benchmark.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file benchmark.h
- * @ingroup COM_AI_RUNTIME
- * @brief This file contains nnfw::misc::benchmark::Accumulator class
- */
-#ifndef __NNFW_MISC_BENCHMARK_H__
-#define __NNFW_MISC_BENCHMARK_H__
-
-#include <chrono>
-
-namespace nnfw
-{
-namespace misc
-{
-// Benckmark support
-namespace benchmark
-{
-
-/**
- * @brief Class to accumulate time during benchmark
- */
-template <typename T> class Accumulator
-{
-public:
- /**
- * @brief Construct a new Accumulator object
- * @param[in] ref Object to keep time duration
- */
- Accumulator(T &ref) : _ref(ref)
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Return the reference of @c ref passed to constructor
- * @return Reference of @c ref
- */
- T &operator()(void) { return _ref; }
-
-private:
- T &_ref;
-};
-
-/**
- * @brief Run passed function and returns accumulated time
- * @tparam T Period used by @c std::chrono::duration_cast
- * @tparam Callable Function type to benchmark
- * @param[in] acc Accumulated time after running @cb
- * @param[in] cb Function to run and benchmark
- * @return Accumulated time
- */
-template <typename T, typename Callable>
-Accumulator<T> &operator<<(Accumulator<T> &&acc, Callable cb)
-{
- auto begin = std::chrono::steady_clock::now();
- cb();
- auto end = std::chrono::steady_clock::now();
-
- acc() += std::chrono::duration_cast<T>(end - begin);
-
- return acc;
-}
-
-template <typename T> Accumulator<T> measure(T &out) { return Accumulator<T>(out); }
-
-} // namespace benchmark
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_BENCHMARK_H__
diff --git a/libs/misc/include/misc/environment.h b/libs/misc/include/misc/environment.h
deleted file mode 100644
index 8e6bd00d5..000000000
--- a/libs/misc/include/misc/environment.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file environment.h
- * @ingroup COM_AI_RUNTIME
- * @brief This file contains utility functions and classes to access environment variables
- */
-
-#ifndef __UTIL_ENVIRONMENT_H__
-#define __UTIL_ENVIRONMENT_H__
-
-namespace nnfw
-{
-namespace misc
-{
-
-/**
- * @brief Get the environment variable of int type
- * @param[in] name Name of the environment variable
- * @param[in] defaultValue Default value when the value of environment variable does not exist
- * @return The int value of the environment variable
- */
-int get_env_int(const char *name, int defaultValue = 0);
-
-/**
- * @brief Get the environment variable of bool type
- * @param[in] name Name of the environment variable
- * @param[in] defaultValue Default value when the value of environment variable does not exist
- * @return @c 0 if the value of the environment variable is @c "0", @c 1 in case of other number
- */
-bool get_env_bool(const char *name, bool defaultValue = false);
-}
-}
-
-#include <string>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace env
-{
-/**
- * @brief Parent struct of @ref IntAccessor and @ref FloatAccessor
- * @tparam T Type of the value of environment variable
- */
-template <typename T> struct Accessor
-{
- /**
- * @brief Destroy the Accessor object
- */
- virtual ~Accessor() = default;
- /**
- * @brief Read the value of environment variable
- * @param[out] out The value of environment variable
- * @return @c true if accessing environment variable is successful,
- * @c false if there is exist no such environment variable
- */
- virtual bool access(T &out) const = 0;
-};
-
-/**
- * @brief Class to read int environment variable
- */
-class IntAccessor : public Accessor<int>
-{
-public:
- /**
- * @brief Construct a new IntAccessor object
- * @param[in] tag Name of environment variable
- */
- IntAccessor(const std::string &tag);
-
-public:
- /**
- * @brief Read the value of environment variable
- * @param[out] out The value of environment variable
- * @return @c true if accessing environment variable is successful,
- * @c false if there is exist no such environment variable
- */
- bool access(int &out) const override;
-
-private:
- std::string _tag;
-};
-
-/**
- * @brief Class to read float environment variable
- */
-class FloatAccessor : public Accessor<float>
-{
-public:
- /**
- * @brief Construct a new FloatAccessor object
- * @param[in] tag Name of environment variable
- */
- FloatAccessor(const std::string &tag);
-
-public:
- /**
- * @brief Read the value of environment variable
- * @param[out] out The value of environment variable
- * @return @c true if accessing environment variable is successful,
- * @c false if there is exist no such environment variable
- */
- bool access(float &out) const override;
-
-private:
- std::string _tag;
-};
-
-} // namespace env
-} // namespace misc
-} // namespace nnfw
-
-#endif // __UTIL_ENVIRONMENT_H__
diff --git a/libs/misc/include/misc/feature/Index.h b/libs/misc/include/misc/feature/Index.h
deleted file mode 100644
index a361d8dd2..000000000
--- a/libs/misc/include/misc/feature/Index.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Index.h
- * @brief This file contains Index class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_FEATURE_INDEX_H__
-#define __NNFW_MISC_FEATURE_INDEX_H__
-
-#include <cstdint>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace feature
-{
-
-/**
- * @brief Class to have the index information for calculating the offset.
- */
-class Index
-{
-public:
- /**
- * @brief Construct Index object using default constrcutor
- */
- Index() = default;
-
-public:
- /**
- * @brief Construct Index object with three indexes of dimensions
- * @param[in] ch The depth index
- * @param[in] row The heigth index
- * @param[in] col The width index
- */
- Index(int32_t ch, int32_t row, int32_t col) : _batch{1}, _ch{ch}, _row{row}, _col{col}
- {
- // DO NOTHING
- }
- /**
- * @brief Construct Index object with four indexes of dimensions
- * @param[in] batch The batch index
- * @param[in] ch The depth index
- * @param[in] row The height index
- * @param[in] col The width index
- */
- Index(int32_t batch, int32_t ch, int32_t row, int32_t col)
- : _batch{batch}, _ch{ch}, _row{row}, _col{col}
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Get the batch index
- * @return The batch index
- */
- int32_t batch(void) const { return _batch; }
- /**
- * @brief Get the depth index
- * @return The depth index
- */
- int32_t ch(void) const { return _ch; }
- /**
- * @brief Get the height index
- * @return The height index
- */
- int32_t row(void) const { return _row; }
- /**
- * @brief Get the width index
- * @return The width index
- */
- int32_t col(void) const { return _col; }
-
-public:
- /**
- * @brief Get the batch index as the lvalue reference
- * @return The reference of the batch value
- */
- int32_t &batch(void) { return _batch; }
- /**
- * @brief Get the depth index as the lvalue reference
- * @return The reference of the depth value
- */
- int32_t &ch(void) { return _ch; }
- /**
- * @brief Get the height index as the lvalue reference
- * @return The reference of the height value
- */
- int32_t &row(void) { return _row; }
- /**
- * @brief Get the width index as the lvalue reference
- * @return The reference of the width value
- */
- int32_t &col(void) { return _col; }
-
-private:
- /**
- * @brief The batch index
- */
- int32_t _batch;
- /**
- * @brief The depth index
- */
- int32_t _ch;
- /**
- * @brief The height index
- */
- int32_t _row;
- /**
- * @brief The width index
- */
- int32_t _col;
-};
-
-} // namespace feature
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_FEATURE_INDEX_H__
diff --git a/libs/misc/include/misc/feature/IndexIterator.h b/libs/misc/include/misc/feature/IndexIterator.h
deleted file mode 100644
index 1cf675526..000000000
--- a/libs/misc/include/misc/feature/IndexIterator.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file IndexIterator.h
- * @brief This file contains IndexIterator class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_FEATURE_INDEX_ITERATOR_H__
-#define __NNFW_MISC_FEATURE_INDEX_ITERATOR_H__
-
-#include "misc/feature/Shape.h"
-
-namespace nnfw
-{
-namespace misc
-{
-namespace feature
-{
-
-/**
- * @brief Class to iterate Callable with Index of feature
- */
-class IndexIterator
-{
-public:
- /**
- * @brief Construct IndexIterator object with Shape of feature
- * @param[in] shape Shape reference of feature
- */
- IndexIterator(const Shape &shape) : _shape{shape}
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Call a function iterated
- * @param[in] cb A callback function
- * @return Current IndexIterator object
- */
- template <typename Callable> IndexIterator &iter(Callable cb)
- {
- for (int32_t batch = 0; batch < _shape.N; ++batch)
- {
- for (int32_t ch = 0; ch < _shape.C; ++ch)
- {
- for (int32_t row = 0; row < _shape.H; ++row)
- {
- for (int32_t col = 0; col < _shape.W; ++col)
- {
- cb(batch, ch, row, col);
- }
- }
- }
- }
-
- return (*this);
- }
-
-private:
- /**
- * @brief Shape for feature
- */
- const Shape _shape;
-};
-
-/**
- * @brief Create an object of IndexIterator for feature
- * @param[in] Shape reference of feature
- * @return Created IndexIterator object
- */
-static inline IndexIterator iterate(const Shape &shape) { return IndexIterator{shape}; }
-
-/**
- * @brief Call a function iterated using IndexIterator of feature
- * Overloaded operator<<
- * @param[in] it An IndexIterator reference
- * @param[in] cb A callback function
- * @return created IndexIterator object
- */
-template <typename Callable> IndexIterator &operator<<(IndexIterator &&it, Callable cb)
-{
- return it.iter(cb);
-}
-
-} // namespace feature
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_FEATURE_INDEX_ITERATOR_H__
diff --git a/libs/misc/include/misc/feature/Object.h b/libs/misc/include/misc/feature/Object.h
deleted file mode 100644
index 7af0e28f4..000000000
--- a/libs/misc/include/misc/feature/Object.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Object.h
- * @brief This file contains Object class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_FEATURE_OBJECT_H__
-#define __NNFW_MISC_FEATURE_OBJECT_H__
-
-#include "misc/feature/Shape.h"
-#include "misc/feature/Index.h"
-#include "misc/feature/Reader.h"
-
-#include <vector>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace feature
-{
-
-/**
- * @brief Class to have information of the operand for feature
- */
-template <typename T> class Object final : public Reader<T>
-{
-public:
- using Generator = std::function<T(const Shape &shape, const Index &index)>;
-
-public:
- /**
- * @brief Construct Object object with Shape of feature and set value used by Generator
- * @param[in] shape Reference of Shape for feature
- * @param[in] fn A function to set values of operand tensor
- */
- Object(const Shape &shape, const Generator &fn) : _shape{shape}
- {
- _value.resize(_shape.C * _shape.H * _shape.W);
-
- for (int32_t ch = 0; ch < _shape.C; ++ch)
- {
- for (int32_t row = 0; row < _shape.H; ++row)
- {
- for (int32_t col = 0; col < _shape.W; ++col)
- {
- _value.at(offsetOf(ch, row, col)) = fn(_shape, Index{ch, row, col});
- }
- }
- }
- }
-
-public:
- /**
- * @brief Get Shape of feature as the reference
- * @return The reference of the width value
- */
- const Shape &shape(void) const { return _shape; }
-
-public:
- /**
- * @brief Get the value used by three indexes
- * @param[in] ch The depth index
- * @param[in] row The height index
- * @param[in] col The width index
- * @return The value at the offset
- */
- T at(uint32_t ch, uint32_t row, uint32_t col) const override
- {
- return _value.at(offsetOf(ch, row, col));
- }
-
-private:
- /**
- * @brief Get the offset value at three indexes
- * @param[in] ch The depth index
- * @param[in] row The height index
- * @param[in] col The width index
- * @return The offset value
- */
- uint32_t offsetOf(uint32_t ch, uint32_t row, uint32_t col) const
- {
- return ch * _shape.H * _shape.W + row * _shape.W + col;
- }
-
-private:
- /**
- * @brief Shape of operand
- */
- Shape _shape;
- /**
- * @brief The tensor vector of operand
- */
- std::vector<T> _value;
-};
-
-} // namespace feature
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_FEATURE_OBJECT_H__
diff --git a/libs/misc/include/misc/feature/Reader.h b/libs/misc/include/misc/feature/Reader.h
deleted file mode 100644
index b09209789..000000000
--- a/libs/misc/include/misc/feature/Reader.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Reader.h
- * @brief This file contains Reader class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_FEATURE_READER_H__
-#define __NNFW_MISC_FEATURE_READER_H__
-
-#include <cstdint>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace feature
-{
-
-/**
- * @brief Class reads values of feature
- * The interface class
- */
-template <typename T> struct Reader
-{
- /**
- * @brief Destruct Reader object using default destructor
- */
- virtual ~Reader() = default;
-
- /**
- * @brief Get the value used by three indexes
- * @param[in] ch The depth index
- * @param[in] row The height index
- * @param[in] col The width index
- * @return The value at the offset
- */
- virtual T at(uint32_t ch, uint32_t row, uint32_t col) const = 0;
- /**
- * @brief Get the value used by four indexes
- * @param[in] batch The batch index
- * @param[in] ch The depth index
- * @param[in] row The height index
- * @param[in] col The width index
- * @return The value at the offset
- */
- virtual T at(uint32_t batch, uint32_t ch, uint32_t row, uint32_t col) const = 0;
-};
-
-} // namespace feature
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_FEATURE_READER_H__
diff --git a/libs/misc/include/misc/feature/Shape.h b/libs/misc/include/misc/feature/Shape.h
deleted file mode 100644
index 09881f58b..000000000
--- a/libs/misc/include/misc/feature/Shape.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Shape.h
- * @brief This file contains Shape class for feature
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_FEATURE_SHAPE_H__
-#define __NNFW_MISC_FEATURE_SHAPE_H__
-
-#include <cstdint>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace feature
-{
-
-/**
- * @brief Structure to have values of dimensions for feature
- */
-struct Shape
-{
- int32_t N; /**< The batch value */
- int32_t C; /**< The depth value */
- int32_t H; /**< The height value */
- int32_t W; /**< The width value */
-
- /**
- * @brief Construct Shape object using default constrcutor
- */
- Shape() = default;
- /**
- * @brief Construct Shape object with three values of dimensions
- * @param[in] depth The depth value
- * @param[in] height The height value
- * @param[in] width The width value
- */
- Shape(int32_t depth, int32_t height, int32_t width) : N{1}, C{depth}, H{height}, W{width}
- {
- // DO NOTHING
- }
- /**
- * @brief Construct Shape object with four values of dimensions
- * @param[in] batch The batch value
- * @param[in] depth The depth value
- * @param[in] height The height value
- * @param[in] width The width value
- */
- Shape(int32_t batch, int32_t depth, int32_t height, int32_t width)
- : N{batch}, C{depth}, H{height}, W{width}
- {
- // DO NOTHING
- }
-};
-
-} // namespace feature
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_FEATURE_H__
diff --git a/libs/misc/include/misc/feature/TextFormatter.h b/libs/misc/include/misc/feature/TextFormatter.h
deleted file mode 100644
index e053f1c61..000000000
--- a/libs/misc/include/misc/feature/TextFormatter.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file TextFormatter.h
- * @brief This file contains TextFormatter class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_FEATURE_TEXT_FORMATTER_H__
-#define __NNFW_MISC_FEATURE_TEXT_FORMATTER_H__
-
-#include "misc/feature/Shape.h"
-#include "misc/feature/Reader.h"
-
-#include <ostream>
-#include <iomanip>
-#include <limits>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace feature
-{
-
-/**
- * @brief Class to print operand of feature to ostream in the given string format
- */
-template <typename T> class TextFormatter
-{
-public:
- /**
- * @brief Construct TextFormatter object with an operand's information.
- * @param[in] shape The shape of an operand
- * @param[in] data The data of an operand
- */
- TextFormatter(const Shape &shape, const Reader<T> &data) : _shape(shape), _data(data)
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Get Shape of feature as the lvalue reference
- * @return Shape of feature
- */
- const Shape &shape(void) const { return _shape; }
- /**
- * @brief Get Reader<T> that can read the data of an operand
- * @return Reader<T>
- */
- const Reader<T> &data(void) const { return _data; }
-
-private:
- /**
- * @brief Shape of feature
- */
- const Shape &_shape;
- /**
- * @brief Reader<T> that can read the data of an operand
- */
- const Reader<T> &_data;
-};
-
-/**
- * @brief Print operand of feature
- * @param[in] os Standard output stream
- * @param[in] fmt TextFormatter to print information of an operand
- * @return Standard output stream
- */
-template <typename T> std::ostream &operator<<(std::ostream &os, const TextFormatter<T> &fmt)
-{
- const auto &shape = fmt.shape();
-
- for (uint32_t ch = 0; ch < shape.C; ++ch)
- {
- os << " Channel " << ch << ":" << std::endl;
- for (uint32_t row = 0; row < shape.H; ++row)
- {
- os << " ";
- for (uint32_t col = 0; col < shape.W; ++col)
- {
- const auto value = fmt.data().at(ch, row, col);
- os << std::right;
- os << std::fixed;
- os << std::setw(std::numeric_limits<T>::digits10 + 2);
- os << std::setprecision(5);
- os << value;
- os << " ";
- }
- os << std::endl;
- }
- }
-
- return os;
-}
-
-} // namespace feature
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_FEATURE_TEXT_FORMATTER_H__
diff --git a/libs/misc/include/misc/fp32.h b/libs/misc/include/misc/fp32.h
deleted file mode 100644
index c310402ba..000000000
--- a/libs/misc/include/misc/fp32.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file fp32.h
- * @brief This file contains functions to compare float values
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_FP32_H__
-#define __NNFW_MISC_FP32_H__
-
-#include <cmath>
-#include <cfloat>
-#include <algorithm>
-#include <cstdint>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace fp32
-{
-
-/**
- * @brief Get the difference between two float values as a relative value.
- * @param[in] lhs A float value to be compared
- * @param[in] rhs A float value to be compared
- * @return A relative value of difference between two float values.
- */
-inline float relative_diff(float lhs, float rhs)
-{
- const auto diff = std::fabs(lhs - rhs);
- const auto base = std::max(std::fabs(lhs), std::fabs(rhs));
-
- return diff / base;
-}
-
-/**
- * @brief Verify that an obtained float value is equal to the expected float value
- * by using FLT_EPSILON
- * @param[in] expected An expected float value to be compared
- * @param[in] obtained An obtained float value to be compared
- * @param[in] tolerance A tolerance value
- * @return @c true if both values are equal, otherwise @c false
- */
-inline bool epsilon_equal(float expected, float obtained, uint32_t tolerance = 1)
-{
- if (std::isnan(expected) && std::isnan(obtained))
- {
- return true;
- }
-
- // Let's use relative epsilon comparision
- const auto diff = std::fabs(expected - obtained);
- const auto max = std::max(std::fabs(expected), std::fabs(obtained));
-
- return diff <= (max * FLT_EPSILON * tolerance);
-}
-
-/**
- * @brief Verify that an obtained float value is equal to the expected float value
- * by comparing absolute tolerance value
- * @param[in] expected An expected float value to be compared
- * @param[in] obtained An obtained float value to be compared
- * @param[in] tolerance A tolerance value
- * @return @c true if both values are equal, otherwise @c false
- */
-inline bool absolute_epsilon_equal(float expected, float obtained, float tolerance = 0.001)
-{
- if (std::isnan(expected) && std::isnan(obtained))
- {
- return true;
- }
-
- // Let's use absolute epsilon comparision
- const auto diff = std::fabs(expected - obtained);
-
- return diff <= tolerance;
-}
-
-} // namespace fp32
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_FP32_H__
diff --git a/libs/misc/include/misc/kernel/IndexIterator.h b/libs/misc/include/misc/kernel/IndexIterator.h
deleted file mode 100644
index 59e0f0095..000000000
--- a/libs/misc/include/misc/kernel/IndexIterator.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file IndexIterator.h
- * @brief This file contains IndexIterator class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_KERNEL_INDEX_ITERATOR_H__
-#define __NNFW_MISC_KERNEL_INDEX_ITERATOR_H__
-
-#include "misc/kernel/Shape.h"
-
-namespace nnfw
-{
-namespace misc
-{
-namespace kernel
-{
-
-/**
- * @brief Class to iterate Callable with Index of kernel
- */
-class IndexIterator
-{
-public:
- /**
- * @brief Construct IndexIterator object with Shape of kernel
- * @param[in] shape Shape reference of feature
- */
- IndexIterator(const Shape &shape) : _shape{shape}
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Call a function iterated
- * @param[in] cb A callback function
- * @return Current IndexIterator object
- */
- template <typename Callable> IndexIterator &iter(Callable cb)
- {
- for (int32_t nth = 0; nth < _shape.N; ++nth)
- {
- for (int32_t ch = 0; ch < _shape.C; ++ch)
- {
- for (int32_t row = 0; row < _shape.H; ++row)
- {
- for (int32_t col = 0; col < _shape.W; ++col)
- {
- cb(nth, ch, row, col);
- }
- }
- }
- }
-
- return (*this);
- }
-
-private:
- const Shape _shape; /**< Shape for kernel */
-};
-
-/**
- * @brief Create an object of IndexIterator for kernel
- * @param[in] shape reference of feature
- * @return Created IndexIterator object
- */
-inline IndexIterator iterate(const Shape &shape) { return IndexIterator{shape}; }
-
-/**
- * @brief Call a function iterated using IndexIterator of kernel
- * Overloaded operator<<
- * @param[in] it An IndexIterator reference
- * @param[in] cb A callback function
- * @return Created IndexIterator object
- */
-template <typename Callable> IndexIterator &operator<<(IndexIterator &&it, Callable cb)
-{
- return it.iter(cb);
-}
-
-} // namespace kernel
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_FEATURE_INDEX_ITERATOR_H__
diff --git a/libs/misc/include/misc/kernel/RandomObject.h b/libs/misc/include/misc/kernel/RandomObject.h
deleted file mode 100644
index 4b58b0c7f..000000000
--- a/libs/misc/include/misc/kernel/RandomObject.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file RandomObject.h
- * @brief This file contains RandomObject class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_KERNEL_RANDOM_OBJECT_H__
-#define __NNFW_MISC_KERNEL_RANDOM_OBJECT_H__
-
-#include "misc/kernel/Shape.h"
-#include "misc/kernel/Reader.h"
-
-#include <vector>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace kernel
-{
-
-template <typename T> class RandomObject final : public Reader<T>
-{
-public:
- RandomObject(const Shape &shape) : _shape{shape}
- {
- const uint32_t size = _shape.N * _shape.C * _shape.H * _shape.W;
-
- // TODO Use random number
- for (uint32_t off = 0; off < size; ++off)
- {
- _value.emplace_back(static_cast<float>(off));
- }
- }
-
-public:
- const Shape &shape(void) const { return _shape; }
-
-public:
- T at(uint32_t nth, uint32_t ch, uint32_t row, uint32_t col) const override
- {
- uint32_t index = 0;
-
- index += nth * _shape.C * _shape.H * _shape.W;
- index += ch * _shape.H * _shape.W;
- index += row * _shape.W;
- index += col;
-
- return _value.at(index);
- }
-
-private:
- const Shape _shape;
- std::vector<T> _value;
-};
-
-} // namespace kernel
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_KERNEL_RANDOM_OBJECT_H__
diff --git a/libs/misc/include/misc/kernel/Reader.h b/libs/misc/include/misc/kernel/Reader.h
deleted file mode 100644
index 019c809ee..000000000
--- a/libs/misc/include/misc/kernel/Reader.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Reader.h
- * @brief This file contains Reader structure
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_KERNEL_READER_H__
-#define __NNFW_MISC_KERNEL_READER_H__
-
-#include <cstdint>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace kernel
-{
-
-/**
- * @brief Structure to Reader
- */
-template <typename T> struct Reader
-{
- /**
- * @brief Destroy the Reader object as default
- */
- virtual ~Reader() = default;
-
- /**
- * @brief Get the value used by four indexes
- * @param[in] nth The kernel index
- * @param[in] ch The channel index
- * @param[in] row The row index
- * @param[in] col The column index
- * @return The value at the offset
- */
- virtual T at(uint32_t nth, uint32_t ch, uint32_t row, uint32_t col) const = 0;
-};
-
-} // namespace kernel
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_KERNEL_READER_H__
diff --git a/libs/misc/include/misc/kernel/Shape.h b/libs/misc/include/misc/kernel/Shape.h
deleted file mode 100644
index 27d6a8bf0..000000000
--- a/libs/misc/include/misc/kernel/Shape.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Shape.h
- * @brief This file contains Shape structure
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_KERNEL_SHAPE_H__
-#define __NNFW_MISC_KERNEL_SHAPE_H__
-
-#include <cstdint>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace kernel
-{
-
-/**
- * @brief Structure to Shape
- */
-struct Shape
-{
- int32_t N; /**< The kernel index */
- int32_t C; /**< The channel index */
- int32_t H; /**< The height index */
- int32_t W; /**< The width index */
-
- /**
- * @brief Construct a new Shape object as default
- */
- Shape() = default;
-
- /**
- * @brief Construct a new Shape object with parameters
- * @param[in] count The kernel index
- * @param[in] depth The channel index
- * @param[in] height The height index
- * @param[in] width The width index
- */
- Shape(int32_t count, int32_t depth, int32_t height, int32_t width)
- : N{count}, C{depth}, H{height}, W{width}
- {
- // DO NOTHING
- }
-};
-
-} // namespace kernel
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_KERNEL_SHAPE_H__
diff --git a/libs/misc/include/misc/matrix/IndexIterator.h b/libs/misc/include/misc/matrix/IndexIterator.h
deleted file mode 100644
index 742ed3a65..000000000
--- a/libs/misc/include/misc/matrix/IndexIterator.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file IndexIterator.h
- * @brief This file contains IndexIterator class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_MATRIX_INDEX_ITERATOR_H__
-#define __NNFW_MISC_MATRIX_INDEX_ITERATOR_H__
-
-#include "misc/matrix/Shape.h"
-
-namespace nnfw
-{
-namespace misc
-{
-namespace matrix
-{
-
-/**
- * @brief Class to iterate Callable with Index of matrix
- */
-class IndexIterator
-{
-public:
- /**
- * @brief Construct IndexIterator object with Shape of matrix
- * @param[in] shape Shape reference of matrix
- */
- IndexIterator(const Shape &shape) : _shape{shape}
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Call a function iterated
- * @param[in] cb A callback function
- * @return Current IndexIterator object
- */
- template <typename Callable> IndexIterator &iter(Callable cb)
- {
- for (uint32_t row = 0; row < _shape.H; ++row)
- {
- for (uint32_t col = 0; col < _shape.W; ++col)
- {
- cb(row, col);
- }
- }
-
- return (*this);
- }
-
-private:
- /**
- * @brief Shape for matrix
- */
- const Shape _shape;
-};
-
-/**
- * @brief Create an object of IndexIterator for matrix
- * @param[in] Shape reference of matrix
- * @return Created IndexIterator object
- */
-inline IndexIterator iterate(const Shape &shape) { return IndexIterator{shape}; }
-
-/**
- * @brief Call a function iterated using IndexIterator of matrix
- * Overloaded operator<<
- * @param[in] it An IndexIterator reference
- * @param[in] cb A callback function
- * @return created IndexIterator object
- */
-template <typename Callable> IndexIterator &operator<<(IndexIterator &&it, Callable cb)
-{
- return it.iter(cb);
-}
-
-} // namespace matrix
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_MATRIX_INDEX_ITERATOR_H__
diff --git a/libs/misc/include/misc/matrix/Reader.h b/libs/misc/include/misc/matrix/Reader.h
deleted file mode 100644
index ea222c9d1..000000000
--- a/libs/misc/include/misc/matrix/Reader.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Reader.h
- * @brief This file contains Reader class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_MATRIX_READER_H__
-#define __NNFW_MISC_MATRIX_READER_H__
-
-#include <cstdint>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace matrix
-{
-
-/**
- * @brief Class reads values of matrix
- * The interface class
- */
-template <typename T> struct Reader
-{
- /**
- * @brief Destruct Reader object using default destructor
- */
- virtual ~Reader() = default;
-
- /**
- * @brief Get the value used by two indexes
- * @param[in] row The height index
- * @param[in] col The width index
- * @return The value at the offset
- */
- virtual T at(uint32_t row, uint32_t col) const = 0;
-};
-
-} // namespace matrix
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_MATRIX_READER_H__
diff --git a/libs/misc/include/misc/matrix/Shape.h b/libs/misc/include/misc/matrix/Shape.h
deleted file mode 100644
index 8cbcc1e12..000000000
--- a/libs/misc/include/misc/matrix/Shape.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Shape.h
- * @brief This file contains Shape class for matrix
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_MATRIX_SHAPE_H__
-#define __NNFW_MISC_MATRIX_SHAPE_H__
-
-#include <cstdint>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace matrix
-{
-
-/**
- * @brief Structure to have values of dimensions for matrix
- */
-struct Shape
-{
- int32_t H; /**< The height value */
- int32_t W; /**< The width value */
-
- /**
- * @brief Construct Shape object using default constrcutor
- */
- Shape() = default;
-
- /**
- * @brief Construct Shape object with two values of dimensions
- * @param[in] height The height value
- * @param[in] width The width value
- */
- Shape(int32_t height, int32_t width) : H{height}, W{width}
- {
- // DO NOTHING
- }
-};
-
-} // namespace matrix
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_MATRIX_SHAPE_H__
diff --git a/libs/misc/include/misc/tensor/Comparator.h b/libs/misc/include/misc/tensor/Comparator.h
deleted file mode 100644
index 80f53043c..000000000
--- a/libs/misc/include/misc/tensor/Comparator.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Comparator.h
- * @ingroup COM_AI_RUNTIME
- * @brief This file contains nnfw::misc::tensor::Comparator class
- */
-
-#ifndef __NNFW_MISC_TENSOR_COMPARATOR_H__
-#define __NNFW_MISC_TENSOR_COMPARATOR_H__
-
-#include "misc/tensor/Index.h"
-#include "misc/tensor/Shape.h"
-#include "misc/tensor/Reader.h"
-#include "misc/tensor/Diff.h"
-
-#include <functional>
-
-#include <vector>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace tensor
-{
-
-/**
- * @brief Class to compare two tensors (expected and obtained to compare)
- */
-class Comparator
-{
-public:
- /**
- * @brief Construct a new @c Comparator object
- * @param[in] fn Function that compares two float values
- */
- Comparator(const std::function<bool(float lhs, float rhs)> &fn) : _compare_fn{fn}
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Struct to observe comparison results
- */
- struct Observer
- {
- /**
- * @brief Get notification of comparison result at every index of two tensors
- * @param[in] index Index of tensors compared
- * @param[in] expected Expected value of element at @c index
- * @param[in] obtained Obtained value of element at @c index
- * @return N/A
- */
- virtual void notify(const Index &index, float expected, float obtained) = 0;
- };
-
-public:
- /**
- * @brief Compare two tensors
- * @param[in] shape Shape of two tensors
- * @param[in] expected @c Reader<float> object that accesses expected tensor
- * @param[in] obtained @c Reader<float> object that accesses obtained tensor
- * @param[in] observer @c Observer notified of expected value and obtained value at every index
- * @return @c std::vector<Diff<float>> containing information of failed comparison
- */
- // NOTE Observer should live longer than comparator
- std::vector<Diff<float>> compare(const Shape &shape, const Reader<float> &expected,
- const Reader<float> &obtained,
- Observer *observer = nullptr) const;
-
-private:
- std::function<bool(float lhs, float rhs)> _compare_fn;
-};
-
-} // namespace tensor
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_TENSOR_COMPARATOR_H__
diff --git a/libs/misc/include/misc/tensor/Diff.h b/libs/misc/include/misc/tensor/Diff.h
deleted file mode 100644
index c41a97987..000000000
--- a/libs/misc/include/misc/tensor/Diff.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Diff.h
- * @ingroup COM_AI_RUNTIME
- * @brief This file contains nnfw::misc::tensor::Diff struct
- */
-
-#ifndef __NNFW_MISC_TENSOR_DIFF_H__
-#define __NNFW_MISC_TENSOR_DIFF_H__
-
-#include "misc/tensor/Index.h"
-
-namespace nnfw
-{
-namespace misc
-{
-namespace tensor
-{
-
-/**
- * @brief Struct to have information after comparing two elements of two tensors
- */
-template <typename T> struct Diff
-{
- Index index; /**< Index of elements in two tensors, which turn out to be different */
-
- T expected; /**< Expected value of element of first tensor */
- T obtained; /**< Obtained value of element of second tensor */
-
- /**
- * @brief Construct a new @c Diff object
- * @param[in] i Initial value of index
- */
- Diff(const Index &i) : index(i)
- {
- // DO NOTHING
- }
-
- /**
- * @brief Construct a new @c Diff object
- * @param[in] i Index value
- * @param[in] e Expected value of element of first tensor
- * @param[in] o Obtained value of element of second tensor
- */
- Diff(const Index &i, const T &e, const T &o) : index(i), expected{e}, obtained{o}
- {
- // DO NOTHING
- }
-};
-
-} // namespace tensor
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_TENSOR_DIFF_H__
diff --git a/libs/misc/include/misc/tensor/Index.h b/libs/misc/include/misc/tensor/Index.h
deleted file mode 100644
index a08d7099e..000000000
--- a/libs/misc/include/misc/tensor/Index.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Index.h
- * @ingroup COM_AI_RUNTIME
- * @brief This file contains nnfw::misc::tensor::Index struct
- */
-#ifndef __NNFW_MISC_TENSOR_INDEX_H__
-#define __NNFW_MISC_TENSOR_INDEX_H__
-
-#include <cstdint>
-#include <cstddef>
-
-#include <vector>
-#include <initializer_list>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace tensor
-{
-
-/**
- * @brief Struct to represent index of each dimension of a tensor
- */
-struct Index
-{
-public:
- /**
- * @brief Construct a new @c Index object
- * @param[in] rank Rank of a tensor
- */
- Index(size_t rank) { _offsets.resize(rank); }
-
-public:
- /**
- * @brief Construct a new @c Index object
- * @param[in] offsets Rank of a tensor of @c std::initializer_list<int32_t> type
- */
- Index(std::initializer_list<int32_t> offsets) : _offsets{offsets}
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Get the rank
- * @return Rank that this @c Index object can handle
- */
- size_t rank(void) const { return _offsets.size(); }
-
-public:
- /**
- * @brief Get the index n'th dimension
- * @param[in] n Dimension
- * @return index of n'th dimension
- */
- int32_t at(size_t n) const { return _offsets.at(n); }
-
- /**
- * @brief Get the reference of the index n'th dimension
- * @param[in] n Dimension
- * @return reference of index of n'th dimension
- */
- int32_t &at(size_t n) { return _offsets.at(n); }
-
-private:
- std::vector<int32_t> _offsets;
-};
-
-/**
- * @brief Copy an @c Index with reversed order
- * @param[in] origin @c Index object to copy
- * @return an @c Index object with reversed order
- * @note This is used to convert NNAPI tensor index to ARM tensor index or vice versa
- */
-inline static Index copy_reverse(const Index &origin)
-{
- size_t rank = origin.rank();
- Index target(rank);
- for (int i = 0; i < rank; i++)
- target.at(i) = origin.at(rank - 1 - i);
- return target;
-}
-
-} // namespace tensor
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_TENSOR_INDEX_H__
diff --git a/libs/misc/include/misc/tensor/IndexEnumerator.h b/libs/misc/include/misc/tensor/IndexEnumerator.h
deleted file mode 100644
index 4912ea289..000000000
--- a/libs/misc/include/misc/tensor/IndexEnumerator.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file IndexEnumerator.h
- * @ingroup COM_AI_RUNTIME
- * @brief This file contains nnfw::misc::tensor::IndexEnumerator class
- */
-
-#ifndef __NNFW_MISC_TENSOR_INDEX_ENUMERATOR_H__
-#define __NNFW_MISC_TENSOR_INDEX_ENUMERATOR_H__
-
-#include "misc/tensor/Shape.h"
-#include "misc/tensor/Index.h"
-
-namespace nnfw
-{
-namespace misc
-{
-namespace tensor
-{
-/**
- * @brief Class to enumerate index of a tensor
- *
- */
-class IndexEnumerator
-{
-public:
- /**
- * @brief Construct a new @c IndexEnumerator object
- * @param[in] shape Shape of tensor of which index will be enumerate
- */
- explicit IndexEnumerator(const Shape &shape) : _shape(shape), _index(shape.rank()), _cursor(0)
- {
- const size_t rank = _shape.rank();
-
- for (size_t axis = 0; axis < rank; ++axis)
- {
- _index.at(axis) = 0;
- }
-
- for (_cursor = 0; _cursor < rank; ++_cursor)
- {
- if (_index.at(_cursor) < _shape.dim(_cursor))
- {
- break;
- }
- }
- }
-
-public:
- /**
- * @brief Prevent constructing @c IndexEnumerator object by using R-value reference
- */
- IndexEnumerator(IndexEnumerator &&) = delete;
- /**
- * @brief Prevent copy constructor
- */
- IndexEnumerator(const IndexEnumerator &) = delete;
-
-public:
- /**
- * @brief Check if more enumeration is available
- * @return @c true if more @c advance() is available, otherwise @c false
- */
- bool valid(void) const { return _cursor < _shape.rank(); }
-
-public:
- /**
- * @brief Get the current index to enumerate
- * @return Current index
- */
- const Index &curr(void) const { return _index; }
-
-public:
- /**
- * @brief Advance index by +1
- */
- void advance(void)
- {
- const size_t rank = _shape.rank();
-
- // Find axis to be updated
- while ((_cursor < rank) && !(_index.at(_cursor) + 1 < _shape.dim(_cursor)))
- {
- ++_cursor;
- }
-
- if (_cursor == rank)
- {
- return;
- }
-
- // Update index
- _index.at(_cursor) += 1;
-
- for (size_t axis = 0; axis < _cursor; ++axis)
- {
- _index.at(axis) = 0;
- }
-
- // Update cursor
- _cursor = 0;
- }
-
-public:
- const Shape _shape; //!< Shape to enumerate
-
-private:
- size_t _cursor;
- Index _index;
-};
-
-} // namespace tensor
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_TENSOR_INDEX_ENUMERATOR_H__
diff --git a/libs/misc/include/misc/tensor/IndexFormatter.h b/libs/misc/include/misc/tensor/IndexFormatter.h
deleted file mode 100644
index 7ae34eec1..000000000
--- a/libs/misc/include/misc/tensor/IndexFormatter.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file IndexFormatter.h
- * @ingroup COM_AI_RUNTIME
- * @brief This file contains nnfw::misc::tensor::IndexFormatter class
- */
-
-#ifndef __NNFW_MISC_TENSOR_INDEX_FORMATTER_H__
-#define __NNFW_MISC_TENSOR_INDEX_FORMATTER_H__
-
-#include "misc/tensor/Index.h"
-
-#include <ostream>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace tensor
-{
-
-/**
- * @brief Class to send @c Index object to output stream
- */
-class IndexFormatter
-{
-public:
- /**
- * @brief Construct a new @c IndexFormatter object
- * @param[in] index index to be sent to output stream
- */
- IndexFormatter(const nnfw::misc::tensor::Index &index) : _index(index)
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Get an @c Index object
- * @return @c Index object previously passed to the constructor
- */
- const nnfw::misc::tensor::Index &index(void) const { return _index; }
-
-private:
- const nnfw::misc::tensor::Index &_index;
-};
-
-/**
- * @brief Send @c IndexFormatter object to output stream
- * @param[in] os Output stream
- * @param[in] fmt @c IndexFormatter object that is sent to output stream
- * @return Output stream
- */
-std::ostream &operator<<(std::ostream &os, const IndexFormatter &fmt);
-
-} // namespace tensor
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_TENSOR_INDEX_FORMATTER_H__
diff --git a/libs/misc/include/misc/tensor/IndexIterator.h b/libs/misc/include/misc/tensor/IndexIterator.h
deleted file mode 100644
index f6428e19e..000000000
--- a/libs/misc/include/misc/tensor/IndexIterator.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file IndexIterator.h
- * @ingroup COM_AI_RUNTIME
- * @brief This file contains nnfw::misc::tensor::IndexIterator class and
- * helper function and operator
- */
-#ifndef __NNFW_MISC_TENSOR_INDEX_ITERATOR_H__
-#define __NNFW_MISC_TENSOR_INDEX_ITERATOR_H__
-
-#include "misc/tensor/Shape.h"
-#include "misc/tensor/Index.h"
-#include "misc/tensor/IndexEnumerator.h"
-
-namespace nnfw
-{
-namespace misc
-{
-namespace tensor
-{
-
-/**
- * @brief Class to iterate indexes available for given shape
- */
-class IndexIterator
-{
-public:
- /**
- * @brief Construct a new @c IndexIterator object
- * @param[in] shape Shape of tensor of which index will be iterated
- */
- IndexIterator(const Shape &shape) : _shape(shape)
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Construct a new IndexIterator object using reference
- * @param[in] IndexIterator @c IndexIterator object to move
- */
- IndexIterator(IndexIterator &&) = default;
-
- /**
- * @brief Prevent copy constructor
- */
- IndexIterator(const IndexIterator &) = delete;
-
-public:
- /**
- * @brief Iterate all available indexes and run a function for each index
- * @param[in] fn Function that requires an index as a parameter.
- * @return @c IndexIterator object
- */
- template <typename Callable> IndexIterator &iter(Callable fn)
- {
- for (IndexEnumerator e{_shape}; e.valid(); e.advance())
- {
- fn(e.curr());
- }
-
- return (*this);
- }
-
-private:
- const Shape &_shape;
-};
-
-/**
- * @brief Get an @c IndexItator object
- * @param[in] shape Shape of tensor of which index will be iterated
- * @return @c IndexIterator object
- */
-inline IndexIterator iterate(const Shape &shape) { return IndexIterator{shape}; }
-
-/**
- * @brief Iterate all indexes and apply a function
- * @param[in] it @c IndexIterator object that is constructed with a tensor shape
- * @param[in] cb A function that will receive a specific index.
- * Inside the function, the index is used to manipulate tensor element.
- * @return @c IndexIterator object
- */
-template <typename Callable> IndexIterator &operator<<(IndexIterator &&it, Callable cb)
-{
- return it.iter(cb);
-}
-
-} // namespace tensor
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_TENSOR_INDEX_ITERATOR_H__
diff --git a/libs/misc/include/misc/tensor/NonIncreasingStride.h b/libs/misc/include/misc/tensor/NonIncreasingStride.h
deleted file mode 100644
index e7ad0857b..000000000
--- a/libs/misc/include/misc/tensor/NonIncreasingStride.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file NonIncreasingStride.h
- * @ingroup COM_AI_RUNTIME
- * @brief This file contains nnfw::misc::tensor::NonIncreasingStride class
- */
-#ifndef __NNFW_MISC_TENSOR_NON_INCREASING_STRIDE_H__
-#define __NNFW_MISC_TENSOR_NON_INCREASING_STRIDE_H__
-
-#include "misc/tensor/Shape.h"
-#include "misc/tensor/Index.h"
-
-#include <vector>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace tensor
-{
-
-/**
- * @brief Class to represent strides where stride[N-1] >= stride[N] holds for all N < rank
- */
-class NonIncreasingStride
-{
-public:
- /**
- * @brief Initialize the stride data using @c Shape
- * @param[in] shape to build stride info
- * @return N/A
- */
- void init(const Shape &shape)
- {
- _stride.resize(shape.rank());
- _stride.at(shape.rank() - 1) = 1;
-
- for (uint32_t axis = shape.rank() - 1; axis > 0; --axis)
- {
- _stride.at(axis - 1) = _stride.at(axis) * shape.dim(axis);
- }
- }
-
-public:
- /**
- * @brief Get an stride value for specific axis
- * @param[in] axis Axis of stride
- * @return The value of stride
- */
- uint32_t at(uint32_t axis) const { return _stride.at(axis); }
-
-public:
- /**
- * @brief Get the 1-D offset of specified index for n-D tensor
- * @param index @c Index object
- * @return 1-D offset of index
- */
- uint32_t offset(const Index &index) const;
-
-private:
- std::vector<uint32_t> _stride;
-};
-
-} // namespace tensor
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_TENSOR_NON_INCREASING_STRIDE_H__
diff --git a/libs/misc/include/misc/tensor/Object.h b/libs/misc/include/misc/tensor/Object.h
deleted file mode 100644
index 83fbc0bd1..000000000
--- a/libs/misc/include/misc/tensor/Object.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Object.h
- * @ingroup COM_AI_RUNTIME
- * @brief This file contains nnfw::misc::tensor::Object class
- */
-
-#ifndef __NNFW_MISC_TENSOR_OBJECT_H__
-#define __NNFW_MISC_TENSOR_OBJECT_H__
-
-#include "misc/tensor/Shape.h"
-#include "misc/tensor/Index.h"
-#include "misc/tensor/IndexIterator.h"
-#include "misc/tensor/NonIncreasingStride.h"
-#include "misc/tensor/Reader.h"
-
-#include <vector>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace tensor
-{
-
-/**
- * @brief Class to build a tensor using specific generator
- * @tparam T Type of tensor element
- */
-
-template <typename T> class Object final : public Reader<T>
-{
-public:
- /**
- * @brief Function to generate tensor element
- */
- using Generator = std::function<T(const Shape &shape, const Index &index)>;
-
-public:
- /**
- * @brief Construct a new @c Object object
- * @param[in] shape Tensor shape
- * @param[in] fn Function to generate tensor elements
- */
- Object(const Shape &shape, const Generator &fn) : _shape{shape}
- {
- // Set 'stride'
- _stride.init(shape);
-
- // Pre-allocate buffer
- _values.resize(_shape.dim(0) * _stride.at(0));
-
- // Set 'value'
- iterate(_shape) <<
- [this, &fn](const Index &index) { _values.at(_stride.offset(index)) = fn(_shape, index); };
- }
-
-public:
- /**
- * @brief Get reference of shape
- * @return Reference of shape
- */
- const Shape &shape(void) const { return _shape; }
-
-public:
- /**
- * @brief Get and element of tensor
- * @param[in] index Index of a tensor element
- * @return Value of tensor element
- */
- T at(const Index &index) const override { return _values.at(_stride.offset(index)); }
-
-private:
- Shape _shape;
- NonIncreasingStride _stride;
-
-private:
- std::vector<T> _values;
-};
-
-} // namespace tensor
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_FEATURE_OBJECT_H__
diff --git a/libs/misc/include/misc/tensor/Reader.h b/libs/misc/include/misc/tensor/Reader.h
deleted file mode 100644
index 9175a913e..000000000
--- a/libs/misc/include/misc/tensor/Reader.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Reader.h
- * @ingroup COM_AI_RUNTIME
- * @brief This file contains nnfw::misc::tensor::Reader struct
- */
-
-#ifndef __NNFW_MISC_TENSOR_READER_H__
-#define __NNFW_MISC_TENSOR_READER_H__
-
-#include "misc/tensor/Index.h"
-
-namespace nnfw
-{
-namespace misc
-{
-namespace tensor
-{
-
-/**
- * @brief Struct to read element of tensor
- * @tparam T Type of elements in tensor
- */
-template <typename T> struct Reader
-{
- /**
- * @brief Destroy the Reader object
- */
- virtual ~Reader() = default;
-
- /**
- * @brief Get an element of tensor
- * @param[in] index Index specifying indexes of tensor element
- * @return The value of specificed element
- */
- virtual T at(const Index &index) const = 0;
-};
-
-} // namespace tensor
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_TENSOR_READER_H__
diff --git a/libs/misc/include/misc/tensor/Shape.h b/libs/misc/include/misc/tensor/Shape.h
deleted file mode 100644
index 6e6c23502..000000000
--- a/libs/misc/include/misc/tensor/Shape.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Shape.h
- * @ingroup COM_AI_RUNTIME
- * @brief This file contains nnfw::misc::tensor::Shape class
- */
-
-#ifndef __NNFW_MISC_TENSOR_SHAPE_H__
-#define __NNFW_MISC_TENSOR_SHAPE_H__
-
-#include <cstdint>
-#include <cstddef>
-#include <deque>
-#include <initializer_list>
-#include <ostream>
-#include <string>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace tensor
-{
-
-/**
- * @brief Class to represent shape of a tensor
- */
-class Shape
-{
-public:
- /**
- * @brief Construct a new Shape object
- * @param[in] rank Rank of a tensor
- */
- Shape(size_t rank) { _dimensions.resize(rank); }
-
-public:
- /**
- * @brief Construct a new Shape object
- * @param[in] dimensions @c initializer_list<int32_t> of dimensions of tensor
- */
- Shape(const std::initializer_list<int32_t> &dimensions) : _dimensions{dimensions}
- {
- // DO NOTHING
- }
-
- /**
- * @brief Construct a new Shape object
- * @param[in] origin @c Shape object to copy
- */
- Shape(const Shape &origin) = default;
-
-public:
- /**
- * @brief Add dimension to the beginning
- * @param[in] d dimension to add to the beginning
- * @return N/A
- */
- void prepend(int32_t d) { _dimensions.emplace_front(d); }
-
- /**
- * @brief Add dimension to the back
- * @param[in] d dimension to add to the back
- * @return N/A
- */
- void append(int32_t d) { _dimensions.emplace_back(d); }
-
-public:
- /**
- * @brief Get the rank of this shape
- * @return rank
- */
- size_t rank(void) const { return _dimensions.size(); }
-
-public:
- /**
- * @brief Get specific dimension
- * @param[in] n Index of dimension
- * @return n'th dimension
- */
- int32_t dim(size_t n) const { return _dimensions.at(n); }
-
- /**
- * @brief Get the reference of specific dimension
- * @param[in] n Index of dimension
- * @return Reference of n'th dimension
- */
- int32_t &dim(size_t n) { return _dimensions.at(n); }
-
-public:
- /**
- * @brief Get the number of elements specified by this shape
- * @return The number of elements
- */
- size_t element_nums() const
- {
- size_t nums = 1;
- for (auto d : _dimensions)
- {
- nums *= d;
- }
- return nums;
- }
-
-private:
- std::deque<int32_t> _dimensions;
-
-public:
- /**
- * @brief Get a @c Shape object after parsing string
- * @param[in] s String of dimension list. Accepted format is numbers separated by comma.
- * @return @c Shape object
- */
- static Shape from(const std::string &s);
-};
-
-/**
- * @brief Check equality of two @c Shape
- * @param[in] Shape First shape to compare
- * @param[in] Shape Second shape to compare
- * @return @c true if both shapes are equal, otherwise @c false
- */
-bool operator==(const Shape &, const Shape &);
-
-/**
- * @brief Send @c Shape to @c std::ostream
- * @param[in] os @c std::ostream to process this @c Shape
- * @param[in] shape @c Shape to send to @c ostream
- * @return Reference of @c std::ostream
- */
-std::ostream &operator<<(std::ostream &os, const Shape &shape);
-
-} // namespace tensor
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_TENSOR_SHAPE_H__
diff --git a/libs/misc/include/misc/tensor/Zipper.h b/libs/misc/include/misc/tensor/Zipper.h
deleted file mode 100644
index 8f0ec4ab6..000000000
--- a/libs/misc/include/misc/tensor/Zipper.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Zipper.h
- * @ingroup COM_AI_RUNTIME
- * @brief This file contains nnfw::misc::tensor::Zipper class
- */
-
-#ifndef __NNFW_MISC_TENSOR_ZIPPER_H__
-#define __NNFW_MISC_TENSOR_ZIPPER_H__
-
-#include "misc/tensor/Index.h"
-#include "misc/tensor/IndexIterator.h"
-#include "misc/tensor/Reader.h"
-
-namespace nnfw
-{
-namespace misc
-{
-namespace tensor
-{
-
-/**
- * @brief Class to apply a function with three params: @c Index, elements of a tensor
- * at passed index read by @c Reader objects
- */
-template <typename T> class Zipper
-{
-public:
- /**
- * @brief Construct a new @c Zipper object
- * @param[in] shape Shape of @c lhs and @c rhs
- * @param[in] lhs @c Reader object of a tensor
- * @param[in] rhs @c Reader object of a tensor
- */
- Zipper(const Shape &shape, const Reader<T> &lhs, const Reader<T> &rhs)
- : _shape{shape}, _lhs{lhs}, _rhs{rhs}
- {
- // DO NOTHING
- }
-
-public:
- /**
- * @brief Apply @c cb to all elements of tensors. Elements of two tensors
- * at passed @c index are read by @c lhs and @c rhs
- * @param[in] cb Function to apply
- * @return N/A
- */
- template <typename Callable> void zip(Callable cb) const
- {
- iterate(_shape) <<
- [this, &cb](const Index &index) { cb(index, _lhs.at(index), _rhs.at(index)); };
- }
-
-private:
- const Shape &_shape;
- const Reader<T> &_lhs;
- const Reader<T> &_rhs;
-};
-
-/**
- * @brief Apply @c cb by using @c lhs and @c rhs passed to the constructor of @c zipper
- * @param[in] zipper @c Zipper object
- * @param[in] cb Function to zpply using @c zip function
- * @return @c zipper object after applying @c cb to @c zipper
- */
-template <typename T, typename Callable>
-const Zipper<T> &operator<<(const Zipper<T> &zipper, Callable cb)
-{
- zipper.zip(cb);
- return zipper;
-}
-
-/**
- * @brief Get @c Zipper object constructed using passed params
- * @param shape Shape of @c lhs and @c rhs
- * @param lhs @c Reader object of a tensor
- * @param rhs @c Reader object of a tensor
- * @return @c Zipper object
- */
-template <typename T> Zipper<T> zip(const Shape &shape, const Reader<T> &lhs, const Reader<T> &rhs)
-{
- return Zipper<T>{shape, lhs, rhs};
-}
-
-} // namespace tensor
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_TENSOR_ZIPPER_H__
diff --git a/libs/misc/include/misc/vector.h b/libs/misc/include/misc/vector.h
deleted file mode 100644
index 395b08912..000000000
--- a/libs/misc/include/misc/vector.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file vector.h
- * @ingroup COM_AI_RUNTIME
- * @brief This file contains @c == operator to check equality of elements in two vectors
- */
-#ifndef __NNFW_MISC_VECTOR_H__
-#define __NNFW_MISC_VECTOR_H__
-
-#include <vector>
-
-/**
- * @brief Compare elements of two vectors
- * @tparam T Type of elements in vectors
- * @param[in] lhs First vector to compare
- * @param[in] rhs Second vector to compare
- * @return @c true if all elements are equal, otherwise @c false.
- */
-template <typename T> bool operator==(const std::vector<T> &lhs, const std::vector<T> &rhs)
-{
- if (lhs.size() != rhs.size())
- {
- return false;
- }
-
- for (size_t ind = 0; ind < lhs.size(); ++ind)
- {
- if (lhs.at(ind) != rhs.at(ind))
- {
- return false;
- }
- }
-
- return true;
-}
-
-#endif // __NNFW_MISC_VECTOR_H__
diff --git a/libs/misc/include/misc/vector/Object.h b/libs/misc/include/misc/vector/Object.h
deleted file mode 100644
index 65d4bc613..000000000
--- a/libs/misc/include/misc/vector/Object.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Object.h
- * @brief This file contains Object class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_VECTOR_OBJECT_H__
-#define __NNFW_MISC_VECTOR_OBJECT_H__
-
-#include "misc/vector/Reader.h"
-
-#include <vector>
-#include <functional>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace vector
-{
-
-/**
- * @brief Class to have information of the operand for vector
- */
-template <typename T> class Object final : public Reader<T>
-{
-public:
- using Generator = std::function<T(int32_t size, int32_t offset)>;
-
-public:
- /**
- * @brief Construct Object object with size of vector and set value used by Generator
- * @param[in] size The size of vector
- * @param[in] gen A function to set values of operand tensor
- */
- Object(int32_t size, const Generator &gen) : _size{size}
- {
- _value.resize(_size);
-
- for (int32_t offset = 0; offset < size; ++offset)
- {
- _value.at(offset) = gen(size, offset);
- }
- }
-
-public:
- /**
- * @brief Get size of vector
- * @return Size of vector
- */
- int32_t size(void) const { return _size; }
-
-public:
- /**
- * @brief Get the value used by index
- * @param[in] nth The vector index
- * @return The value at the offset
- */
- T at(uint32_t nth) const override { return _value.at(nth); }
-
-private:
- /**
- * @brief Size of vector
- */
- const int32_t _size;
- /**
- * @brief The tensor vector of operand
- */
- std::vector<T> _value;
-};
-
-} // namespace vector
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_VECTOR_OBJECT_H__
diff --git a/libs/misc/include/misc/vector/Reader.h b/libs/misc/include/misc/vector/Reader.h
deleted file mode 100644
index eab4c427b..000000000
--- a/libs/misc/include/misc/vector/Reader.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file Reader.h
- * @brief This file contains Reader class
- * @ingroup COM_AI_RUNTIME
- */
-
-#ifndef __NNFW_MISC_VECTOR_READER_H__
-#define __NNFW_MISC_VECTOR_READER_H__
-
-#include <cstdint>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace vector
-{
-
-/**
- * @brief Class reads values of vector
- * The interface class
- */
-template <typename T> struct Reader
-{
- /**
- * @brief Destruct Reader object using default destructor
- */
- virtual ~Reader() = default;
-
- /**
- * @brief Get the value used by the index
- * @param[in] nth The vector index
- * @return The value at the offset
- */
- virtual T at(uint32_t nth) const = 0;
-};
-
-} // namespace vector
-} // namespace misc
-} // namespace nnfw
-
-#endif // __NNFW_MISC_VECTOR_READER_H__
diff --git a/libs/misc/src/environment.cpp b/libs/misc/src/environment.cpp
deleted file mode 100644
index e39f18d62..000000000
--- a/libs/misc/src/environment.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <string.h>
-#include <cstdlib>
-#include <string>
-
-#include "misc/environment.h"
-
-namespace nnfw
-{
-namespace misc
-{
-
-int get_env_int(const char *name, int defaultValue)
-{
- const char *value = std::getenv(name);
- if (value != nullptr)
- return std::stoi(value);
- return defaultValue;
-}
-
-bool get_env_bool(const char *name, bool defaultValue)
-{
- const char *value = std::getenv(name);
- if (value != nullptr)
- {
- return std::stoi(value) != 0;
- }
-
- return defaultValue;
-}
-
-} // namespace misc
-} // namespace nnfw
-
-namespace nnfw
-{
-namespace misc
-{
-namespace env
-{
-
-IntAccessor::IntAccessor(const std::string &tag) : _tag{tag}
-{
- // DO NOTHING
-}
-
-bool IntAccessor::access(int &out) const
-{
- auto value = std::getenv(_tag.c_str());
-
- if (value == nullptr)
- {
- return false;
- }
-
- out = std::stoi(value);
- return true;
-}
-
-FloatAccessor::FloatAccessor(const std::string &tag) : _tag{tag}
-{
- // DO NOTHING
-}
-
-bool FloatAccessor::access(float &out) const
-{
- auto value = std::getenv(_tag.c_str());
-
- if (value == nullptr)
- {
- return false;
- }
-
- out = std::stof(value);
- return true;
-}
-
-} // namespace env
-} // namespace misc
-} // namespace nnfw
diff --git a/libs/misc/src/tensor/Comparator.cpp b/libs/misc/src/tensor/Comparator.cpp
deleted file mode 100644
index 013c9eed2..000000000
--- a/libs/misc/src/tensor/Comparator.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#include "misc/tensor/Comparator.h"
-#include "misc/tensor/Zipper.h"
-
-#include "misc/fp32.h"
-
-namespace nnfw
-{
-namespace misc
-{
-namespace tensor
-{
-
-std::vector<Diff<float>> Comparator::compare(const Shape &shape, const Reader<float> &expected,
- const Reader<float> &obtained,
- Observer *observer) const
-{
- std::vector<Diff<float>> res;
-
- zip(shape, expected, obtained) <<
- [&](const Index &index, float expected_value, float obtained_value) {
- const auto relative_diff = nnfw::misc::fp32::relative_diff(expected_value, obtained_value);
-
- if (!_compare_fn(expected_value, obtained_value))
- {
- res.emplace_back(index, expected_value, obtained_value);
- }
-
- // Update max_diff_index, if necessary
- if (observer != nullptr)
- {
- observer->notify(index, expected_value, obtained_value);
- }
- };
-
- return res;
-}
-
-} // namespace tensor
-} // namespace misc
-} // namespace nnfw
diff --git a/libs/misc/src/tensor/IndexFormatter.cpp b/libs/misc/src/tensor/IndexFormatter.cpp
deleted file mode 100644
index c949db7a8..000000000
--- a/libs/misc/src/tensor/IndexFormatter.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "misc/tensor/IndexFormatter.h"
-
-#include <cassert>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace tensor
-{
-
-std::ostream &operator<<(std::ostream &os, const IndexFormatter &fmt)
-{
- const auto rank = fmt.index().rank();
-
- assert(rank > 0);
-
- os << fmt.index().at(0);
-
- if (rank > 1)
- {
- for (uint32_t axis = 1; axis < rank; ++axis)
- {
- os << ", " << fmt.index().at(axis);
- }
- }
-
- return os;
-}
-
-} // namespace tensor
-} // namespace misc
-} // namespace nnfw
diff --git a/libs/misc/src/tensor/NonIncreasingStride.cpp b/libs/misc/src/tensor/NonIncreasingStride.cpp
deleted file mode 100644
index c51ad0324..000000000
--- a/libs/misc/src/tensor/NonIncreasingStride.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "misc/tensor/NonIncreasingStride.h"
-
-#include <cassert>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace tensor
-{
-
-uint32_t NonIncreasingStride::offset(const Index &index) const
-{
- const size_t rank = _stride.size();
-
- assert(index.rank() == rank);
-
- uint32_t offset = 0;
-
- for (size_t axis = 0; axis < rank; ++axis)
- {
- offset += _stride.at(axis) * index.at(axis);
- }
-
- return offset;
-}
-
-} // namespace tensor
-} // namespace misc
-} // namespace nnfw
diff --git a/libs/misc/src/tensor/Shape.cpp b/libs/misc/src/tensor/Shape.cpp
deleted file mode 100644
index 675695e8e..000000000
--- a/libs/misc/src/tensor/Shape.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "misc/tensor/Shape.h"
-
-#include <cassert>
-
-namespace nnfw
-{
-namespace misc
-{
-namespace tensor
-{
-
-bool operator==(const Shape &lhs, const Shape &rhs)
-{
- if (lhs.rank() != rhs.rank())
- {
- return false;
- }
-
- for (size_t axis = 0; axis < lhs.rank(); ++axis)
- {
- if (lhs.dim(axis) != rhs.dim(axis))
- {
- return false;
- }
- }
-
- return true;
-}
-
-Shape Shape::from(const std::string &str)
-{
- Shape shape(0);
-
- bool pending = false;
- int value = 0;
-
- for (const char *cur = str.c_str(); true; ++cur)
- {
- if (*cur == ',' || *cur == '\0')
- {
- if (pending)
- {
- shape.append(value);
- }
-
- if (*cur == '\0')
- {
- break;
- }
-
- pending = false;
- value = 0;
- continue;
- }
-
- assert(*cur >= '0' && *cur <= '9');
-
- pending = true;
- value *= 10;
- value += *cur - '0';
- }
-
- return shape;
-}
-
-std::ostream &operator<<(std::ostream &os, const Shape &shape)
-{
- if (shape.rank() > 0)
- {
- os << shape.dim(0);
-
- for (uint32_t axis = 1; axis < shape.rank(); ++axis)
- {
- os << "," << shape.dim(axis);
- }
- }
-
- return os;
-}
-
-} // namespace tensor
-} // namespace misc
-} // namespace nnfw