aboutsummaryrefslogtreecommitdiff
path: root/src/armnnUtils
diff options
context:
space:
mode:
Diffstat (limited to 'src/armnnUtils')
-rw-r--r--src/armnnUtils/DataLayoutIndexed.cpp3
-rw-r--r--src/armnnUtils/DataLayoutIndexed.hpp72
-rw-r--r--src/armnnUtils/FloatingPointConverter.cpp2
-rw-r--r--src/armnnUtils/FloatingPointConverter.hpp21
-rw-r--r--src/armnnUtils/ParserHelper.cpp2
-rw-r--r--src/armnnUtils/Permute.cpp5
-rw-r--r--src/armnnUtils/Permute.hpp20
-rw-r--r--src/armnnUtils/TensorUtils.cpp2
-rw-r--r--src/armnnUtils/TensorUtils.hpp41
-rw-r--r--src/armnnUtils/test/TensorUtilsTest.cpp4
10 files changed, 10 insertions, 162 deletions
diff --git a/src/armnnUtils/DataLayoutIndexed.cpp b/src/armnnUtils/DataLayoutIndexed.cpp
index 02f1e816ac..92051b6c83 100644
--- a/src/armnnUtils/DataLayoutIndexed.cpp
+++ b/src/armnnUtils/DataLayoutIndexed.cpp
@@ -3,7 +3,8 @@
// SPDX-License-Identifier: MIT
//
-#include "DataLayoutIndexed.hpp"
+#include <armnnUtils/DataLayoutIndexed.hpp>
+
using namespace armnn;
namespace armnnUtils
diff --git a/src/armnnUtils/DataLayoutIndexed.hpp b/src/armnnUtils/DataLayoutIndexed.hpp
deleted file mode 100644
index 8bd9701a5e..0000000000
--- a/src/armnnUtils/DataLayoutIndexed.hpp
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include <armnn/Types.hpp>
-#include <armnn/Tensor.hpp>
-
-#include <boost/assert.hpp>
-
-namespace armnnUtils
-{
-
-// Provides access to the appropriate indexes for Channels, Height and Width based on DataLayout
-class DataLayoutIndexed
-{
-public:
- DataLayoutIndexed(armnn::DataLayout dataLayout);
-
- armnn::DataLayout GetDataLayout() const { return m_DataLayout; }
- unsigned int GetChannelsIndex() const { return m_ChannelsIndex; }
- unsigned int GetHeightIndex() const { return m_HeightIndex; }
- unsigned int GetWidthIndex() const { return m_WidthIndex; }
-
- inline unsigned int GetIndex(const armnn::TensorShape& shape,
- unsigned int batchIndex, unsigned int channelIndex,
- unsigned int heightIndex, unsigned int widthIndex) const
- {
- BOOST_ASSERT( batchIndex < shape[0] || ( shape[0] == 0 && batchIndex == 0 ) );
- BOOST_ASSERT( channelIndex < shape[m_ChannelsIndex] ||
- ( shape[m_ChannelsIndex] == 0 && channelIndex == 0) );
- BOOST_ASSERT( heightIndex < shape[m_HeightIndex] ||
- ( shape[m_HeightIndex] == 0 && heightIndex == 0) );
- BOOST_ASSERT( widthIndex < shape[m_WidthIndex] ||
- ( shape[m_WidthIndex] == 0 && widthIndex == 0) );
-
- // Offset the given indices appropriately depending on the data layout
- switch (m_DataLayout)
- {
- case armnn::DataLayout::NHWC:
- batchIndex *= shape[1] * shape[2] * shape[3]; // batchIndex *= heightIndex * widthIndex * channelIndex
- heightIndex *= shape[m_WidthIndex] * shape[m_ChannelsIndex];
- widthIndex *= shape[m_ChannelsIndex];
- // channelIndex stays unchanged
- break;
- case armnn::DataLayout::NCHW:
- default:
- batchIndex *= shape[1] * shape[2] * shape[3]; // batchIndex *= heightIndex * widthIndex * channelIndex
- channelIndex *= shape[m_HeightIndex] * shape[m_WidthIndex];
- heightIndex *= shape[m_WidthIndex];
- // widthIndex stays unchanged
- break;
- }
-
- // Get the value using the correct offset
- return batchIndex + channelIndex + heightIndex + widthIndex;
- }
-
-private:
- armnn::DataLayout m_DataLayout;
- unsigned int m_ChannelsIndex;
- unsigned int m_HeightIndex;
- unsigned int m_WidthIndex;
-};
-
-// Equality methods
-bool operator==(const armnn::DataLayout& dataLayout, const DataLayoutIndexed& indexed);
-bool operator==(const DataLayoutIndexed& indexed, const armnn::DataLayout& dataLayout);
-
-} // namespace armnnUtils
diff --git a/src/armnnUtils/FloatingPointConverter.cpp b/src/armnnUtils/FloatingPointConverter.cpp
index 92409d4eea..3bdde11eb8 100644
--- a/src/armnnUtils/FloatingPointConverter.cpp
+++ b/src/armnnUtils/FloatingPointConverter.cpp
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: MIT
//
-#include "FloatingPointConverter.hpp"
+#include <armnnUtils/FloatingPointConverter.hpp>
#include "Half.hpp"
diff --git a/src/armnnUtils/FloatingPointConverter.hpp b/src/armnnUtils/FloatingPointConverter.hpp
deleted file mode 100644
index 7b201c7ead..0000000000
--- a/src/armnnUtils/FloatingPointConverter.hpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include <cstddef>
-
-namespace armnnUtils
-{
-class FloatingPointConverter
-{
-public:
- // Converts a buffer of FP32 values to FP16, and stores in the given dstFloat16Buffer.
- // dstFloat16Buffer should be (numElements * 2) in size
- static void ConvertFloat32To16(const float *srcFloat32Buffer, size_t numElements, void *dstFloat16Buffer);
-
- static void ConvertFloat16To32(const void *srcFloat16Buffer, size_t numElements, float *dstFloat32Buffer);
-};
-} //namespace armnnUtils
diff --git a/src/armnnUtils/ParserHelper.cpp b/src/armnnUtils/ParserHelper.cpp
index 2286f8b6ed..990a9b2098 100644
--- a/src/armnnUtils/ParserHelper.cpp
+++ b/src/armnnUtils/ParserHelper.cpp
@@ -6,7 +6,7 @@
#include "ParserHelper.hpp"
// armnnUtils
-#include "Permute.hpp"
+#include <armnnUtils/Permute.hpp>
#include <boost/format.hpp>
diff --git a/src/armnnUtils/Permute.cpp b/src/armnnUtils/Permute.cpp
index 24a8286bba..a758bd9fbf 100644
--- a/src/armnnUtils/Permute.cpp
+++ b/src/armnnUtils/Permute.cpp
@@ -3,10 +3,11 @@
// SPDX-License-Identifier: MIT
//
-#include "Permute.hpp"
+#include <armnn/Tensor.hpp>
+
+#include <armnnUtils/Permute.hpp>
#include "Half.hpp"
-#include <armnn/Tensor.hpp>
#include <cassert>
#include <cstring>
diff --git a/src/armnnUtils/Permute.hpp b/src/armnnUtils/Permute.hpp
deleted file mode 100644
index b9ef94bc86..0000000000
--- a/src/armnnUtils/Permute.hpp
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include <armnn/TensorFwd.hpp>
-#include <armnn/Types.hpp>
-
-namespace armnnUtils
-{
-
-armnn::TensorShape Permuted(const armnn::TensorShape& srcShape, const armnn::PermutationVector& mappings);
-
-armnn::TensorInfo Permuted(const armnn::TensorInfo& info, const armnn::PermutationVector& mappings);
-
-void Permute(const armnn::TensorShape& dstShape, const armnn::PermutationVector& mappings,
- const void* src, void* dst, size_t dataTypeSize);
-
-} // namespace armnnUtils
diff --git a/src/armnnUtils/TensorUtils.cpp b/src/armnnUtils/TensorUtils.cpp
index 601277491c..c1d1200938 100644
--- a/src/armnnUtils/TensorUtils.cpp
+++ b/src/armnnUtils/TensorUtils.cpp
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: MIT
//
-#include "TensorUtils.hpp"
+#include <armnnUtils/TensorUtils.hpp>
#include <backendsCommon/ITensorHandle.hpp>
diff --git a/src/armnnUtils/TensorUtils.hpp b/src/armnnUtils/TensorUtils.hpp
deleted file mode 100644
index b67431d757..0000000000
--- a/src/armnnUtils/TensorUtils.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include <armnn/TypesUtils.hpp>
-
-#include <boost/assert.hpp>
-
-namespace armnnUtils
-{
-armnn::TensorShape GetTensorShape(unsigned int numberOfBatches,
- unsigned int numberOfChannels,
- unsigned int height,
- unsigned int width,
- const armnn::DataLayout dataLayout);
-
-armnn::TensorInfo GetTensorInfo(unsigned int numberOfBatches,
- unsigned int numberOfChannels,
- unsigned int height,
- unsigned int width,
- const armnn::DataLayout dataLayout,
- const armnn::DataType dataType);
-
-std::pair<float, float> FindMinMax(armnn::ITensorHandle* tensorHandle);
-
-armnn::TensorShape ExpandDims(const armnn::TensorShape& tensorShape, int axis);
-
-unsigned int GetNumElementsBetween(const armnn::TensorShape& shape,
- unsigned int firstAxisInclusive,
- unsigned int lastAxisExclusive);
-
-unsigned int GetUnsignedAxis(const unsigned int inputDimension, const int axis);
-
-unsigned int GetNumElementsAfter(const armnn::TensorShape& shape, unsigned int axis);
-
-std::pair<unsigned int, std::vector<float>> GetPerAxisParams(const armnn::TensorInfo& info);
-
-} // namespace armnnUtils
diff --git a/src/armnnUtils/test/TensorUtilsTest.cpp b/src/armnnUtils/test/TensorUtilsTest.cpp
index a903b63f83..d24740b762 100644
--- a/src/armnnUtils/test/TensorUtilsTest.cpp
+++ b/src/armnnUtils/test/TensorUtilsTest.cpp
@@ -3,10 +3,10 @@
// SPDX-License-Identifier: MIT
//
-#include <TensorUtils.hpp>
-
#include <armnn/Types.hpp>
+#include <armnnUtils/TensorUtils.hpp>
+
#include <boost/test/unit_test.hpp>
using namespace armnn;