aboutsummaryrefslogtreecommitdiff
path: root/src/backends/backendsCommon/test/layerTests
diff options
context:
space:
mode:
authorNarumol Prangnawarat <narumol.prangnawarat@arm.com>2020-04-01 16:51:23 +0100
committerNarumol Prangnawarat <narumol.prangnawarat@arm.com>2020-04-06 09:06:01 +0100
commitac2770a4bb6461bfbddec928bb6208f26f898f02 (patch)
treec72f67f648b7aca2f4bccf69b05d185bf5f9ccad /src/backends/backendsCommon/test/layerTests
parent7ee5d2c3b3cee5a924ed6347fef613ee07b5aca7 (diff)
downloadarmnn-ac2770a4bb6461bfbddec928bb6208f26f898f02.tar.gz
IVGCVSW-4485 Remove Boost assert
* Change boost assert to armnn assert * Change include file to armnn assert * Fix ARMNN_ASSERT_MSG issue with multiple conditions * Change BOOST_ASSERT to BOOST_TEST where appropriate * Remove unused include statements Signed-off-by: Narumol Prangnawarat <narumol.prangnawarat@arm.com> Change-Id: I5d0fa3a37b7c1c921216de68f0073aa34702c9ff
Diffstat (limited to 'src/backends/backendsCommon/test/layerTests')
-rw-r--r--src/backends/backendsCommon/test/layerTests/ActivationTestImpl.cpp4
-rw-r--r--src/backends/backendsCommon/test/layerTests/ComparisonTestImpl.cpp10
-rw-r--r--src/backends/backendsCommon/test/layerTests/ConcatTestImpl.cpp18
-rw-r--r--src/backends/backendsCommon/test/layerTests/Conv2dTestImpl.cpp20
-rw-r--r--src/backends/backendsCommon/test/layerTests/LayerTestResult.hpp3
-rw-r--r--src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.cpp2
6 files changed, 28 insertions, 29 deletions
diff --git a/src/backends/backendsCommon/test/layerTests/ActivationTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/ActivationTestImpl.cpp
index 319434e093..a82048cd81 100644
--- a/src/backends/backendsCommon/test/layerTests/ActivationTestImpl.cpp
+++ b/src/backends/backendsCommon/test/layerTests/ActivationTestImpl.cpp
@@ -1212,9 +1212,9 @@ LayerTestResult<T,4> CompareActivationTestImpl(
SetWorkloadOutput(refData, refInfo, 0, outputTensorInfo, outputHandleRef.get());
std::unique_ptr<armnn::IWorkload> workload = workloadFactory.CreateActivation(data, info);
- BOOST_ASSERT(workload != nullptr);
+ ARMNN_ASSERT(workload != nullptr);
std::unique_ptr<armnn::IWorkload> workloadRef = refWorkloadFactory.CreateActivation(refData, refInfo);
- BOOST_ASSERT(workloadRef != nullptr);
+ ARMNN_ASSERT(workloadRef != nullptr);
inputHandle->Allocate();
outputHandle->Allocate();
diff --git a/src/backends/backendsCommon/test/layerTests/ComparisonTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/ComparisonTestImpl.cpp
index 2156b0ee9e..a6b703b08b 100644
--- a/src/backends/backendsCommon/test/layerTests/ComparisonTestImpl.cpp
+++ b/src/backends/backendsCommon/test/layerTests/ComparisonTestImpl.cpp
@@ -5,7 +5,7 @@
#include "ComparisonTestImpl.hpp"
-
+#include <armnn/utility/Assert.hpp>
#include <Half.hpp>
#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
@@ -18,8 +18,6 @@
#include <test/TensorHelpers.hpp>
-#include <boost/assert.hpp>
-
namespace
{
@@ -44,13 +42,13 @@ LayerTestResult<uint8_t, NumDims> ComparisonTestImpl(
int outQuantOffset)
{
IgnoreUnused(memoryManager);
- BOOST_ASSERT(shape0.GetNumDimensions() == NumDims);
+ ARMNN_ASSERT(shape0.GetNumDimensions() == NumDims);
armnn::TensorInfo inputTensorInfo0(shape0, ArmnnInType, quantScale0, quantOffset0);
- BOOST_ASSERT(shape1.GetNumDimensions() == NumDims);
+ ARMNN_ASSERT(shape1.GetNumDimensions() == NumDims);
armnn::TensorInfo inputTensorInfo1(shape1, ArmnnInType, quantScale1, quantOffset1);
- BOOST_ASSERT(outShape.GetNumDimensions() == NumDims);
+ ARMNN_ASSERT(outShape.GetNumDimensions() == NumDims);
armnn::TensorInfo outputTensorInfo(outShape, armnn::DataType::Boolean, outQuantScale, outQuantOffset);
auto input0 = MakeTensor<InType, NumDims>(inputTensorInfo0, values0);
diff --git a/src/backends/backendsCommon/test/layerTests/ConcatTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/ConcatTestImpl.cpp
index 1e40b42dcf..9e08e30dec 100644
--- a/src/backends/backendsCommon/test/layerTests/ConcatTestImpl.cpp
+++ b/src/backends/backendsCommon/test/layerTests/ConcatTestImpl.cpp
@@ -61,7 +61,7 @@ bool NeedPermuteForConcat(
}
else
{
- BOOST_ASSERT_MSG(nDimensions == tensorInfo.GetShape().GetNumDimensions(),
+ ARMNN_ASSERT_MSG(nDimensions == tensorInfo.GetShape().GetNumDimensions(),
"Input shapes must have the same number of dimensions");
}
}
@@ -92,7 +92,7 @@ void Generate3dPermuteVectorForConcat(
unsigned int & concatDim,
std::pair<PermutationVector, PermutationVector> & permutations)
{
- BOOST_ASSERT_MSG(numDimensions <= 3,
+ ARMNN_ASSERT_MSG(numDimensions <= 3,
"Only dimensions 1,2 and 3 are supported by this helper");
unsigned int expandedBy = 3 - numDimensions;
unsigned int expandedConcatAxis = concatDim + expandedBy;
@@ -113,7 +113,7 @@ void Generate3dPermuteVectorForConcat(
}
else
{
- BOOST_ASSERT(expandedConcatAxis == 0);
+ ARMNN_ASSERT(expandedConcatAxis == 0);
concatDim = 0;
}
}
@@ -127,7 +127,7 @@ template<typename T> void PermuteTensorData(
std::vector<T>& outputData)
{
IgnoreUnused(memoryManager);
- BOOST_ASSERT_MSG(inputData != nullptr, "inputData must not be null");
+ ARMNN_ASSERT_MSG(inputData != nullptr, "inputData must not be null");
if (inputData == nullptr)
{
// Nullptr is an error in the test. By returning without doing the concatenation
@@ -179,7 +179,7 @@ template<typename T> void PermuteInputsForConcat(
TensorInfo & outputTensorInfo)
{
IgnoreUnused(memoryManager);
- BOOST_ASSERT_MSG(inputTensorInfos.size() > 1,
+ ARMNN_ASSERT_MSG(inputTensorInfos.size() > 1,
"Expecting more than one tensor to be concatenated here");
unsigned int numDims = 0;
@@ -200,12 +200,12 @@ template<typename T> void PermuteInputsForConcat(
// Store the reverese permutation.
permuteVector = permutations.second;
- BOOST_ASSERT_MSG(!permuteVector.IsEqual(identity),
+ ARMNN_ASSERT_MSG(!permuteVector.IsEqual(identity),
"Test logic error, we don't need permutation, so we shouldn't arrive here");
}
else
{
- BOOST_ASSERT_MSG(numDims == tensorInfo.GetShape().GetNumDimensions(),
+ ARMNN_ASSERT_MSG(numDims == tensorInfo.GetShape().GetNumDimensions(),
"All inputs must have the same number of dimensions");
}
@@ -244,7 +244,7 @@ template <typename T> void PermuteOutputForConcat(
std::unique_ptr<ITensorHandle> && inputDataHandle,
T * data)
{
- BOOST_ASSERT_MSG(data != nullptr, "data must not be null");
+ ARMNN_ASSERT_MSG(data != nullptr, "data must not be null");
if (data == nullptr)
{
// Nullptr is an error in the test. By returning without doing the permutation
@@ -279,7 +279,7 @@ template<typename T> void Concatenate(
unsigned int concatDim,
bool useSubtensor)
{
- BOOST_ASSERT_MSG(output != nullptr, "output must not be null");
+ ARMNN_ASSERT_MSG(output != nullptr, "output must not be null");
if (output == nullptr)
{
// Nullptr is an error in the test. By returning without doing the permutation
diff --git a/src/backends/backendsCommon/test/layerTests/Conv2dTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/Conv2dTestImpl.cpp
index 50ad667dde..c66027efdf 100644
--- a/src/backends/backendsCommon/test/layerTests/Conv2dTestImpl.cpp
+++ b/src/backends/backendsCommon/test/layerTests/Conv2dTestImpl.cpp
@@ -169,9 +169,9 @@ template<typename T, typename B>
void ApplyBias(std::vector<T>& v, float vScale, int32_t vOffset,
const std::vector<B>& bias, float bScale, int32_t bOffset, uint32_t w, uint32_t h)
{
- BOOST_ASSERT_MSG((armnn::IsQuantizedType<T>() && vScale != 0.0f) || (!armnn::IsQuantizedType<T>()),
+ ARMNN_ASSERT_MSG((armnn::IsQuantizedType<T>() && vScale != 0.0f) || (!armnn::IsQuantizedType<T>()),
"Invalid type and parameter combination.");
- BOOST_ASSERT_MSG((armnn::IsQuantizedType<B>() && bScale != 0.0f) || (!armnn::IsQuantizedType<B>()),
+ ARMNN_ASSERT_MSG((armnn::IsQuantizedType<B>() && bScale != 0.0f) || (!armnn::IsQuantizedType<B>()),
"Invalid type and parameter combination.");
// Note we need to dequantize and re-quantize the image value and the bias.
@@ -183,7 +183,7 @@ void ApplyBias(std::vector<T>& v, float vScale, int32_t vOffset,
for (uint32_t x = 0; x < w; ++x)
{
uint32_t offset = (i * h + y) * w + x;
- BOOST_ASSERT(offset < v.size());
+ ARMNN_ASSERT(offset < v.size());
T& outRef = v[offset];
float dOutput = SelectiveDequantize(outRef, vScale, vOffset);
outRef = SelectiveQuantize<T>(dOutput + dBias, vScale, vOffset);
@@ -236,11 +236,11 @@ LayerTestResult<T, 4> SimpleConvolution2dTestImpl(
bool biasEnabled = bias.size() > 0;
// This function currently assumes 1 batch of input/output (and duplicates this into 2 batches).
- BOOST_ASSERT(inputNum == 1);
- BOOST_ASSERT(outputNum == 1);
+ ARMNN_ASSERT(inputNum == 1);
+ ARMNN_ASSERT(outputNum == 1);
// If a bias is used, its size must equal the number of output channels.
- BOOST_ASSERT(!biasEnabled || bias.size() == outputChannels);
+ ARMNN_ASSERT(!biasEnabled || bias.size() == outputChannels);
// Note these tensors will use two (identical) batches.
@@ -1627,7 +1627,7 @@ LayerTestResult<T, 4> DepthwiseConvolution2dAsymmetricTestImpl(
// If a bias is used, its size must equal the number of output channels.
bool biasEnabled = bias.size() > 0;
- BOOST_ASSERT(!biasEnabled || bias.size() == outputChannels);
+ ARMNN_ASSERT(!biasEnabled || bias.size() == outputChannels);
// Creates the tensors.
armnn::TensorInfo inputTensorInfo =
@@ -2135,11 +2135,11 @@ LayerTestResult<T, 4> DepthwiseConvolution2dTestImpl(
bool biasEnabled = bias.size() > 0;
// This function currently assumes 1 batch of input/output (and duplicates this into 2 batches).
- BOOST_ASSERT(inputNum == 1);
- BOOST_ASSERT(outputNum == 1);
+ ARMNN_ASSERT(inputNum == 1);
+ ARMNN_ASSERT(outputNum == 1);
// If a bias is used, its size must equal the number of output channels.
- BOOST_ASSERT(!biasEnabled || bias.size() == outputChannels);
+ ARMNN_ASSERT(!biasEnabled || bias.size() == outputChannels);
// Note these tensors will use two (identical) batches.
diff --git a/src/backends/backendsCommon/test/layerTests/LayerTestResult.hpp b/src/backends/backendsCommon/test/layerTests/LayerTestResult.hpp
index c277d2d5e1..c64fc88024 100644
--- a/src/backends/backendsCommon/test/layerTests/LayerTestResult.hpp
+++ b/src/backends/backendsCommon/test/layerTests/LayerTestResult.hpp
@@ -6,6 +6,7 @@
#pragma once
#include <armnn/Tensor.hpp>
+#include <armnn/utility/Assert.hpp>
#include <boost/multi_array.hpp>
@@ -14,7 +15,7 @@
template <std::size_t n>
boost::array<unsigned int, n> GetTensorShapeAsArray(const armnn::TensorInfo& tensorInfo)
{
- BOOST_ASSERT_MSG(n == tensorInfo.GetNumDimensions(),
+ ARMNN_ASSERT_MSG(n == tensorInfo.GetNumDimensions(),
"Attempting to construct a shape array of mismatching size");
boost::array<unsigned int, n> shape;
diff --git a/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.cpp
index 772ae2ccc7..953b543acb 100644
--- a/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.cpp
+++ b/src/backends/backendsCommon/test/layerTests/SoftmaxTestImpl.cpp
@@ -104,7 +104,7 @@ LayerTestResult<T, n> SimpleSoftmaxBaseTestImpl(
outputHandle->Allocate();
CopyDataToITensorHandle(inputHandle.get(), input.origin());
- BOOST_ASSERT(workload);
+ ARMNN_ASSERT(workload);
ExecuteWorkload(*workload, memoryManager);