aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Hughes <robert.hughes@arm.com>2020-05-20 15:27:37 +0100
committerRob Hughes <robert.hughes@arm.com>2020-06-02 13:55:30 +0000
commitbb46dde88befe14583eaac83f65775a7543d4586 (patch)
tree61baff7d93acd0a24184bc0dfa8af540168e1e4c
parent8acafd13ad2169b6edc86f5e42602ec604d39648 (diff)
downloadarmnn-bb46dde88befe14583eaac83f65775a7543d4586.tar.gz
Fix a few build warnings:
* Remove redundant asserts for unsigned ints being positive * Remove unneeded include of lightweight_test.hpp header * Remove unused exception variable names * Replace hardcoded 0.0f with T() for some template functions * Add a few static_casts Change-Id: I290b0433cf995f6d0199422eaa10f816e5fd8eb9 Signed-off-by: Robert Hughes <robert.hughes@arm.com>
-rw-r--r--profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp4
-rw-r--r--src/armnn/test/UtilityTests.cpp1
-rw-r--r--src/armnnTfLiteParser/test/GetBuffer.cpp2
-rw-r--r--src/backends/backendsCommon/test/JsonPrinterTestImpl.cpp4
-rw-r--r--src/backends/backendsCommon/test/layerTests/Conv2dTestImpl.cpp6
-rw-r--r--src/backends/backendsCommon/test/layerTests/LstmTestImpl.cpp76
-rw-r--r--src/backends/backendsCommon/test/layerTests/TransposeConvolution2dTestImpl.cpp2
-rw-r--r--src/profiling/test/ProfilingMocks.hpp8
-rw-r--r--src/profiling/test/SendCounterPacketTests.cpp4
-rw-r--r--tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp3
10 files changed, 55 insertions, 55 deletions
diff --git a/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp b/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp
index c97fecd94d..57fc9e9da6 100644
--- a/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp
+++ b/profiling/server/src/basePipeServer/tests/BasePipeServerTests.cpp
@@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE(BasePipeServerTest)
unsigned int readBufferSize = packetBuffer->GetSize();
BOOST_TEST(readBuffer);
- BOOST_TEST(readBufferSize > 0);
+ BOOST_TEST(readBufferSize > 0u);
socketProfilingConnection.WritePacket(readBuffer,readBufferSize);
bufferManager.MarkRead(packetBuffer);
@@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(BasePipeServerTest)
readBufferSize = packetBuffer->GetSize();
BOOST_TEST(readBuffer);
- BOOST_TEST(readBufferSize > 0);
+ BOOST_TEST(readBufferSize > 0u);
socketProfilingConnection.WritePacket(readBuffer,readBufferSize);
bufferManager.MarkRead(packetBuffer);
diff --git a/src/armnn/test/UtilityTests.cpp b/src/armnn/test/UtilityTests.cpp
index af56364b15..8d933eb435 100644
--- a/src/armnn/test/UtilityTests.cpp
+++ b/src/armnn/test/UtilityTests.cpp
@@ -4,7 +4,6 @@
//
#include <boost/test/unit_test.hpp>
-#include <boost/core/lightweight_test.hpp>
#define ARMNN_POLYMORPHIC_CAST_TESTABLE
#define ARMNN_NUMERIC_CAST_TESTABLE
diff --git a/src/armnnTfLiteParser/test/GetBuffer.cpp b/src/armnnTfLiteParser/test/GetBuffer.cpp
index 6eecf4f8ee..cccdbce7aa 100644
--- a/src/armnnTfLiteParser/test/GetBuffer.cpp
+++ b/src/armnnTfLiteParser/test/GetBuffer.cpp
@@ -120,7 +120,7 @@ BOOST_FIXTURE_TEST_CASE(GetBufferCheckParseException, GetBufferFixture)
{
//Check if armnn::ParseException thrown when invalid buffer index used
TfLiteParser::ModelPtr model = TfLiteParser::LoadModelFromBinary(m_GraphBinary.data(), m_GraphBinary.size());
- BOOST_CHECK_THROW(TfLiteParser::GetBuffer(model, 4)->data.empty(), armnn::Exception);
+ BOOST_CHECK_THROW(TfLiteParser::GetBuffer(model, 4), armnn::Exception);
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/backends/backendsCommon/test/JsonPrinterTestImpl.cpp b/src/backends/backendsCommon/test/JsonPrinterTestImpl.cpp
index 2aa713f1ed..50dc61b1f4 100644
--- a/src/backends/backendsCommon/test/JsonPrinterTestImpl.cpp
+++ b/src/backends/backendsCommon/test/JsonPrinterTestImpl.cpp
@@ -65,7 +65,7 @@ std::vector<double> ExtractMeasurements(const std::string& exp)
armnn::stringUtils::StringTrim(numberString, "\t,\n");
numbers.push_back(std::stod(numberString));
}
- catch (std::invalid_argument const& e)
+ catch (std::invalid_argument const&)
{
BOOST_FAIL("Could not convert measurements to double: " + numberString);
}
@@ -80,7 +80,7 @@ std::vector<double> ExtractMeasurements(const std::string& exp)
armnn::stringUtils::StringTrim(numberString, "\t,\n");
numbers.push_back(std::stod(numberString));
}
- catch (std::invalid_argument const& e)
+ catch (std::invalid_argument const&)
{
BOOST_FAIL("Could not convert measurements to double: " + numberString);
}
diff --git a/src/backends/backendsCommon/test/layerTests/Conv2dTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/Conv2dTestImpl.cpp
index 154ece2657..acc888ebc0 100644
--- a/src/backends/backendsCommon/test/layerTests/Conv2dTestImpl.cpp
+++ b/src/backends/backendsCommon/test/layerTests/Conv2dTestImpl.cpp
@@ -76,7 +76,7 @@ boost::multi_array<T, 1> GetBias2(bool biasEnabled, float qScale)
if(biasEnabled)
{
armnn::TensorInfo biasDesc({static_cast<unsigned int>(Bias2.size())}, ArmnnType);
- boost::multi_array<T, 1> bias = MakeTensor<T, 1>(biasDesc, QuantizedVector<T>(Bias2, qScale, 0.0f));
+ boost::multi_array<T, 1> bias = MakeTensor<T, 1>(biasDesc, QuantizedVector<T>(Bias2, qScale, 0));
return bias;
}
else
@@ -92,7 +92,7 @@ boost::multi_array<T, 1> GetBias4(bool biasEnabled, float qScale)
if(biasEnabled)
{
armnn::TensorInfo biasDesc({static_cast<unsigned int>(Bias4.size())}, ArmnnType);
- boost::multi_array<T, 1> bias = MakeTensor<T, 1>(biasDesc, QuantizedVector<T>(Bias4, qScale, 0.0f));
+ boost::multi_array<T, 1> bias = MakeTensor<T, 1>(biasDesc, QuantizedVector<T>(Bias4, qScale, 0));
return bias;
}
else
@@ -108,7 +108,7 @@ boost::multi_array<T, 1> GetBias8(bool biasEnabled, float qScale)
if(biasEnabled)
{
armnn::TensorInfo biasDesc({static_cast<unsigned int>(Bias4.size())}, ArmnnType);
- boost::multi_array<T, 1> bias = MakeTensor<T, 1>(biasDesc, QuantizedVector<T>(Bias8, qScale, 0.0f));
+ boost::multi_array<T, 1> bias = MakeTensor<T, 1>(biasDesc, QuantizedVector<T>(Bias8, qScale, 0));
return bias;
}
else
diff --git a/src/backends/backendsCommon/test/layerTests/LstmTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/LstmTestImpl.cpp
index 0ae55e4c60..c7f902ab04 100644
--- a/src/backends/backendsCommon/test/layerTests/LstmTestImpl.cpp
+++ b/src/backends/backendsCommon/test/layerTests/LstmTestImpl.cpp
@@ -160,28 +160,28 @@ LstmNoCifgNoPeepholeNoProjectionTestImpl(
LayerTestResult<T, 2> ret(outputTensorInfo);
- std::vector<float> inputVector;
+ std::vector<T> inputVector;
inputVector.assign(input.data(), input.data() + (batchSize * inputSize));
- auto inputTensor = MakeTensor<float,2>(inputTensorInfo, inputVector);
+ auto inputTensor = MakeTensor<T,2>(inputTensorInfo, inputVector);
- std::vector<float> cellStateInVector(batchSize * numUnits, 0.f);
- auto cellStateInTensor = MakeTensor<float,2>(cellStateInTensorInfo, cellStateInVector);
+ std::vector<T> cellStateInVector(batchSize * numUnits, T());
+ auto cellStateInTensor = MakeTensor<T,2>(cellStateInTensorInfo, cellStateInVector);
- std::vector<float> outputStateInVector(batchSize * outputSize, 0.f);
- auto outputStateInTensor = MakeTensor<float,2>(outputStateInTensorInfo, outputStateInVector);
+ std::vector<T> outputStateInVector(batchSize * outputSize, T());
+ auto outputStateInTensor = MakeTensor<T,2>(outputStateInTensorInfo, outputStateInVector);
- std::vector<float> scratchBufferVector(batchSize * numUnits * 4, 0.f);
- auto scratchBufferTensor = MakeTensor<float,2>(scratchBufferTensorInfo, scratchBufferVector);
+ std::vector<T> scratchBufferVector(batchSize * numUnits * 4, T());
+ auto scratchBufferTensor = MakeTensor<T,2>(scratchBufferTensorInfo, scratchBufferVector);
- std::vector<float> outputStateOutVector(batchSize * outputSize, 0.f);
- auto outputStateOutTensor = MakeTensor<float,2>(outputStateOutTensorInfo, outputStateOutVector);
+ std::vector<T> outputStateOutVector(batchSize * outputSize, T());
+ auto outputStateOutTensor = MakeTensor<T,2>(outputStateOutTensorInfo, outputStateOutVector);
- std::vector<float> cellStateOutVector(batchSize * numUnits, 0.f);
- auto cellStateOutTensor = MakeTensor<float,2>(cellStateOutTensorInfo, cellStateOutVector);
+ std::vector<T> cellStateOutVector(batchSize * numUnits, T());
+ auto cellStateOutTensor = MakeTensor<T,2>(cellStateOutTensorInfo, cellStateOutVector);
- std::vector<float> outputVector;
+ std::vector<T> outputVector;
outputVector.assign(outputExpected.data(), outputExpected.data() + (batchSize * outputSize));
- ret.outputExpected = MakeTensor<float, 2>(outputTensorInfo, outputVector);
+ ret.outputExpected = MakeTensor<T, 2>(outputTensorInfo, outputVector);
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr<armnn::ITensorHandle> cellStateInHandle =
@@ -363,28 +363,28 @@ LstmLayerNoCifgWithPeepholeWithProjectionTestImpl(armnn::IWorkloadFactory& workl
LayerTestResult<T, 2> ret(outputTensorInfo);
- std::vector<float> inputVector;
+ std::vector<T> inputVector;
inputVector.assign(input.data(), input.data() + (batchSize * inputSize));
- auto inputTensor = MakeTensor<float,2>(inputTensorInfo, inputVector);
+ auto inputTensor = MakeTensor<T,2>(inputTensorInfo, inputVector);
- std::vector<float> cellStateInVector(batchSize * numUnits, 0.f);
- auto cellStateInTensor = MakeTensor<float,2>(cellStateInTensorInfo, cellStateInVector);
+ std::vector<T> cellStateInVector(batchSize * numUnits, T());
+ auto cellStateInTensor = MakeTensor<T,2>(cellStateInTensorInfo, cellStateInVector);
- std::vector<float> outputStateInVector(batchSize * outputSize, 0.f);
- auto outputStateInTensor = MakeTensor<float,2>(outputStateInTensorInfo, outputStateInVector);
+ std::vector<T> outputStateInVector(batchSize * outputSize, T());
+ auto outputStateInTensor = MakeTensor<T,2>(outputStateInTensorInfo, outputStateInVector);
- std::vector<float> scratchBufferVector(batchSize * numUnits * 4, 0.f);
- auto scratchBufferTensor = MakeTensor<float,2>(scratchBufferTensorInfo, scratchBufferVector);
+ std::vector<T> scratchBufferVector(batchSize * numUnits * 4, T());
+ auto scratchBufferTensor = MakeTensor<T,2>(scratchBufferTensorInfo, scratchBufferVector);
- std::vector<float> outputStateOutVector(batchSize * outputSize, 0.f);
- auto outputStateOutTensor = MakeTensor<float,2>(outputStateOutTensorInfo, outputStateOutVector);
+ std::vector<T> outputStateOutVector(batchSize * outputSize, T());
+ auto outputStateOutTensor = MakeTensor<T,2>(outputStateOutTensorInfo, outputStateOutVector);
- std::vector<float> cellStateOutVector(batchSize * numUnits, 0.f);
- auto cellStateOutTensor = MakeTensor<float,2>(cellStateOutTensorInfo, cellStateOutVector);
+ std::vector<T> cellStateOutVector(batchSize * numUnits, T());
+ auto cellStateOutTensor = MakeTensor<T,2>(cellStateOutTensorInfo, cellStateOutVector);
- std::vector<float> outputVector;
+ std::vector<T> outputVector;
outputVector.assign(outputExpected.data(), outputExpected.data() + (batchSize * outputSize));
- ret.outputExpected = MakeTensor<float, 2>(outputTensorInfo, outputVector);
+ ret.outputExpected = MakeTensor<T, 2>(outputTensorInfo, outputVector);
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr<armnn::ITensorHandle> cellStateInHandle =
@@ -1195,27 +1195,27 @@ LayerTestResult<T, 2> LstmLayerWithCifgWithPeepholeNoProjectionTestImpl(
// List of outputs
- std::vector<float> scratchBufferVector(batchSize * scratchBufferSize, 0.f);
- auto scratchBufferTensor = MakeTensor<float,2>(scratchBufferTensorInfo, scratchBufferVector);
+ std::vector<T> scratchBufferVector(batchSize * scratchBufferSize, T());
+ auto scratchBufferTensor = MakeTensor<T,2>(scratchBufferTensorInfo, scratchBufferVector);
LayerTestResult<T, 2> ret0(scratchBufferTensorInfo);
// Output state for a certain time step
- std::vector<float> outputStateOutVector(batchSize * outputSize, 0.f);
- auto outputStateOutTensor = MakeTensor<float,2>(outputStateOutTensorInfo, outputStateOutVector);
+ std::vector<T> outputStateOutVector(batchSize * outputSize, T());
+ auto outputStateOutTensor = MakeTensor<T,2>(outputStateOutTensorInfo, outputStateOutVector);
LayerTestResult<T, 2> ret1(outputStateOutTensorInfo);
// Cell state for a certain time step
- std::vector<float> cellStateOutVector(batchSize * cellSize, 0.f);
- auto cellStateOutTensor = MakeTensor<float,2>(cellStateOutTensorInfo, cellStateOutVector);
+ std::vector<T> cellStateOutVector(batchSize * cellSize, T());
+ auto cellStateOutTensor = MakeTensor<T,2>(cellStateOutTensorInfo, cellStateOutVector);
LayerTestResult<T, 2> ret2(cellStateOutTensorInfo);
// Output for a certain time step
- std::vector<float> outputVector(batchSize * outputSize, 0.f);
- auto outputTensor = MakeTensor<float, 2>(outputTensorInfo, outputVector);
- std::vector<float> outputData;
+ std::vector<T> outputVector(batchSize * outputSize, T());
+ auto outputTensor = MakeTensor<T, 2>(outputTensorInfo, outputVector);
+ std::vector<T> outputData;
outputData.assign(outputExpected.data(), outputExpected.data() + batchSize*outputSize);
LayerTestResult<T, 2> ret3(outputTensorInfo);
- ret3.outputExpected = MakeTensor<float, 2>(outputTensorInfo, outputData);
+ ret3.outputExpected = MakeTensor<T, 2>(outputTensorInfo, outputData);
// Prepare the inputs and outputs for the workload
std::unique_ptr<armnn::ITensorHandle> inputHandle =
diff --git a/src/backends/backendsCommon/test/layerTests/TransposeConvolution2dTestImpl.cpp b/src/backends/backendsCommon/test/layerTests/TransposeConvolution2dTestImpl.cpp
index 813c623cff..a599bae4b5 100644
--- a/src/backends/backendsCommon/test/layerTests/TransposeConvolution2dTestImpl.cpp
+++ b/src/backends/backendsCommon/test/layerTests/TransposeConvolution2dTestImpl.cpp
@@ -105,7 +105,7 @@ void TransposeConvolution2dTestImpl(armnn::IWorkloadFactory& workloadFactory,
ExecuteWorkload(*workload, memoryManager);
// copy output
- output.second = std::vector<T>(output.first.GetNumElements(), 0.0f);
+ output.second = std::vector<T>(output.first.GetNumElements(), T());
CopyDataFromITensorHandle(output.second.data(), outputHandle.get());
}
diff --git a/src/profiling/test/ProfilingMocks.hpp b/src/profiling/test/ProfilingMocks.hpp
index 2cd44c40a2..28e410fb9a 100644
--- a/src/profiling/test/ProfilingMocks.hpp
+++ b/src/profiling/test/ProfilingMocks.hpp
@@ -111,12 +111,12 @@ public:
if(packetInfo.second != 0)
{
- return std::count(m_WrittenData.begin(), m_WrittenData.end(), packetInfo);
+ return static_cast<long>(std::count(m_WrittenData.begin(), m_WrittenData.end(), packetInfo));
}
else
{
- return std::count_if(m_WrittenData.begin(), m_WrittenData.end(),
- [&packetInfo](const std::pair<PacketType, uint32_t> pair) { return packetInfo.first == pair.first; });
+ return static_cast<long>(std::count_if(m_WrittenData.begin(), m_WrittenData.end(),
+ [&packetInfo](const std::pair<PacketType, uint32_t> pair) { return packetInfo.first == pair.first; }));
}
}
@@ -142,7 +142,7 @@ public:
{
std::lock_guard<std::mutex> lock(m_Mutex);
- return m_WrittenData.size();
+ return static_cast<unsigned long>(m_WrittenData.size());
}
void Clear()
diff --git a/src/profiling/test/SendCounterPacketTests.cpp b/src/profiling/test/SendCounterPacketTests.cpp
index e7e2312cb4..dc9671bcc8 100644
--- a/src/profiling/test/SendCounterPacketTests.cpp
+++ b/src/profiling/test/SendCounterPacketTests.cpp
@@ -2273,7 +2273,7 @@ BOOST_AUTO_TEST_CASE(SendThreadSendStreamMetadataPacket3)
// Check that the buffer contains at least one Stream Metadata packet and no other packets
const auto writtenDataSize = mockProfilingConnection.GetWrittenDataSize();
- BOOST_TEST(writtenDataSize >= 1);
+ BOOST_TEST(writtenDataSize >= 1u);
BOOST_TEST(mockProfilingConnection.CheckForPacket(
{PacketType::StreamMetaData, streamMetadataPacketsize}) == writtenDataSize);
}
@@ -2319,7 +2319,7 @@ BOOST_AUTO_TEST_CASE(SendThreadSendStreamMetadataPacket4)
// Check that the buffer contains at least one Stream Metadata packet and no other packets
const auto writtenDataSize = mockProfilingConnection.GetWrittenDataSize();
- BOOST_TEST(writtenDataSize >= 1);
+ BOOST_TEST(writtenDataSize >= 1u);
BOOST_TEST(mockProfilingConnection.CheckForPacket(
{PacketType::StreamMetaData, streamMetadataPacketsize}) == writtenDataSize);
}
diff --git a/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp b/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp
index ff28eb4f3b..977a114bfd 100644
--- a/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp
+++ b/tests/NetworkExecutionUtils/NetworkExecutionUtils.hpp
@@ -637,7 +637,8 @@ int RunTest(const std::string& format,
try
{
// Coverity fix: An exception of type armnn::InvalidArgumentException is thrown and never caught.
- inputTensorShapes.push_back(std::make_unique<armnn::TensorShape>(dims.size(), dims.data()));
+ inputTensorShapes.push_back(
+ std::make_unique<armnn::TensorShape>(static_cast<unsigned int>(dims.size()), dims.data()));
}
catch (const armnn::InvalidArgumentException& e)
{