aboutsummaryrefslogtreecommitdiff
path: root/src/armnn
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2020-07-28 10:42:13 +0100
committerSadik Armagan <sadik.armagan@arm.com>2020-07-28 16:45:05 +0000
commitd109a4d0fb980f2e97c05cd86451eda0b53f37ef (patch)
tree19092204016ccd60ea36637cc06a48a224508570 /src/armnn
parent2f746b3f346d3efa9071fc53592652425869d6b3 (diff)
downloadarmnn-d109a4d0fb980f2e97c05cd86451eda0b53f37ef.tar.gz
IVGCVSW-4932 Introduce ShapeInferenceMethod to TfLite Parser
* Introduced ShapeInferenceMethod::InferAndValidate to TfLiteParser * Added unit tests Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: Iad4aadce92912e7645b1652019ec4af478b7fc32
Diffstat (limited to 'src/armnn')
-rw-r--r--src/armnn/test/TensorHelpers.hpp36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/armnn/test/TensorHelpers.hpp b/src/armnn/test/TensorHelpers.hpp
index 286d9f396e..45360350dd 100644
--- a/src/armnn/test/TensorHelpers.hpp
+++ b/src/armnn/test/TensorHelpers.hpp
@@ -74,20 +74,26 @@ bool SelectiveCompareBoolean(T a, T b)
template <typename T, std::size_t n>
boost::test_tools::predicate_result CompareTensors(const boost::multi_array<T, n>& a,
const boost::multi_array<T, n>& b,
- bool compareBoolean = false)
+ bool compareBoolean = false,
+ bool isDynamic = false)
{
- // Checks they are same shape.
- for (unsigned int i=0; i<n; i++)
+ if (!isDynamic)
{
- if (a.shape()[i] != b.shape()[i])
+ // Checks they are same shape.
+ for (unsigned int i = 0;
+ i < n;
+ i++)
{
- boost::test_tools::predicate_result res(false);
- res.message() << "Different shapes ["
- << a.shape()[i]
- << "!="
- << b.shape()[i]
- << "]";
- return res;
+ if (a.shape()[i] != b.shape()[i])
+ {
+ boost::test_tools::predicate_result res(false);
+ res.message() << "Different shapes ["
+ << a.shape()[i]
+ << "!="
+ << b.shape()[i]
+ << "]";
+ return res;
+ }
}
}
@@ -190,9 +196,13 @@ boost::multi_array<T, n> MakeTensor(const armnn::TensorInfo& tensorInfo)
// Creates a boost::multi_array with the shape defined by the given TensorInfo and contents defined by the given vector.
template <typename T, std::size_t n>
-boost::multi_array<T, n> MakeTensor(const armnn::TensorInfo& tensorInfo, const std::vector<T>& flat)
+boost::multi_array<T, n> MakeTensor(
+ const armnn::TensorInfo& tensorInfo, const std::vector<T>& flat, bool isDynamic = false)
{
- ARMNN_ASSERT_MSG(flat.size() == tensorInfo.GetNumElements(), "Wrong number of components supplied to tensor");
+ if (!isDynamic)
+ {
+ ARMNN_ASSERT_MSG(flat.size() == tensorInfo.GetNumElements(), "Wrong number of components supplied to tensor");
+ }
std::array<unsigned int, n> shape;