src/armnnUtils/ParserPrototxtFixture.hpp
src/armnnUtils/PrototxtConversions.hpp
src/armnnUtils/PrototxtConversions.cpp
+ src/armnnUtils/QuantizeHelper.hpp
src/armnnUtils/TensorIOUtils.hpp
src/armnnUtils/TensorUtils.hpp
src/armnnUtils/TensorUtils.cpp
src/armnn/test/UnitTests.cpp
src/armnn/test/UnitTests.hpp
src/armnn/test/UtilsTests.cpp
+ src/armnnUtils/test/QuantizeHelperTest.cpp
src/armnnUtils/test/PrototxtConversionsTest.cpp
src/armnnUtils/test/ParserHelperTest.cpp
src/armnnUtils/test/TensorUtilsTest.cpp
#include <armnn/IRuntime.hpp>
#include <armnn/INetwork.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
-
#include <boost/core/ignore_unused.hpp>
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_SUITE(EndToEnd)
-namespace
-{
-
-template<typename T>
-bool IsFloatIterFunc(T iter)
-{
- boost::ignore_unused(iter);
- return IsFloatingPointIterator<T>::value;
-}
-
-} //namespace
-
-BOOST_AUTO_TEST_CASE(QuantizedHelper)
-{
- std::vector<float> fArray;
- BOOST_TEST(IsFloatIterFunc(fArray.begin()) == true);
- BOOST_TEST(IsFloatIterFunc(fArray.cbegin()) == true);
-
- std::vector<double> dArray;
- BOOST_TEST(IsFloatIterFunc(dArray.begin()) == true);
-
- std::vector<int> iArray;
- BOOST_TEST(IsFloatIterFunc(iArray.begin()) == false);
-
- float floats[5];
- BOOST_TEST(IsFloatIterFunc(&floats[0]) == true);
-
- int ints[5];
- BOOST_TEST(IsFloatIterFunc(&ints[0]) == false);
-}
-
BOOST_AUTO_TEST_CASE(ErrorOnLoadNetwork)
{
using namespace armnn;
//
#include <armnn/INetwork.hpp>
+#include <armnn/LayerVisitorBase.hpp>
#include <armnn/Tensor.hpp>
-#include <armnnQuantizer/INetworkQuantizer.hpp>
#include <armnn/Types.hpp>
-#include "armnn/LayerVisitorBase.hpp"
+#include <armnnQuantizer/INetworkQuantizer.hpp>
+
+#include <QuantizeHelper.hpp>
+
#include "../Graph.hpp"
#include "../Network.hpp"
#include "../NetworkQuantizerUtils.hpp"
#include "../OverrideInputRangeVisitor.hpp"
#include "../RangeTracker.hpp"
-#include "../backends/backendsCommon/test/QuantizeHelper.hpp"
#include "../../armnnQuantizer/CommandLineProcessor.hpp"
#include <boost/test/unit_test.hpp>
std::vector<float> input({ value, 0.0f, 0.0f, 1.0f });
const std::vector<float> &inputRef = input;
- auto output = QuantizedVector<uint8_t>(inputInfo.GetQuantizationScale(),
- inputInfo.GetQuantizationOffset(),
- inputRef);
+ auto output = armnnUtils::QuantizedVector<uint8_t>(inputRef,
+ inputInfo.GetQuantizationScale(),
+ inputInfo.GetQuantizationOffset());
return output;
}
//
#pragma once
-#include <armnn/TensorFwd.hpp>
-#include <boost/test/unit_test.hpp>
-#include <boost/multi_array.hpp>
-#include <vector>
-#include <array>
+#include <armnn/Tensor.hpp>
+
+#include <QuantizeHelper.hpp>
#include <boost/assert.hpp>
-#include <boost/test/tools/floating_point_comparison.hpp>
+#include <boost/multi_array.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <boost/random/uniform_real_distribution.hpp>
#include <boost/random/mersenne_twister.hpp>
-#include <boost/numeric/conversion/cast.hpp>
-
-#include <armnn/Tensor.hpp>
-
-#include <backendsCommon/test/QuantizeHelper.hpp>
+#include <boost/test/tools/floating_point_comparison.hpp>
+#include <boost/test/unit_test.hpp>
+#include <array>
#include <cmath>
+#include <vector>
constexpr float g_FloatCloseToZeroTolerance = 1.0e-6f;
{
init[i] = dist(gen);
}
- float qScale = tensorInfo.GetQuantizationScale();
- int32_t qOffset = tensorInfo.GetQuantizationOffset();
- return MakeTensor<T, n>(tensorInfo, QuantizedVector<T>(qScale, qOffset, init));
+
+ const float qScale = tensorInfo.GetQuantizationScale();
+ const int32_t qOffset = tensorInfo.GetQuantizationOffset();
+
+ return MakeTensor<T, n>(tensorInfo, armnnUtils::QuantizedVector<T>(init, qScale, qOffset));
}
#include "ParserFlatbuffersSerializeFixture.hpp"
#include "../Deserializer.hpp"
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
-
#include <boost/test/unit_test.hpp>
#include <string>
constexpr int32_t qOffset = 0; \
RunTest<4, armnn::DataType::dataType, armnn::DataType::Boolean>( \
0, \
- {{ "InputLayer0", QuantizedVector<T>(qScale, qOffset, s_TestData.m_InputData0) }, \
- { "InputLayer1", QuantizedVector<T>(qScale, qOffset, s_TestData.m_InputData1) }}, \
+ {{ "InputLayer0", armnnUtils::QuantizedVector<T>(s_TestData.m_InputData0, qScale, qOffset) }, \
+ { "InputLayer1", armnnUtils::QuantizedVector<T>(s_TestData.m_InputData1, qScale, qOffset) }}, \
{{ "OutputLayer", s_TestData.m_Output##operation }}); \
}
#include "ParserPrototxtFixture.hpp"
#include "ParserHelper.hpp"
+#include <QuantizeHelper.hpp>
+
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
struct DetectionPostProcessFixture : ParserFlatbuffersFixture
// Quantize inputs and outputs
using QuantizedContainer = std::vector<uint8_t>;
- QuantizedContainer quantBoxEncodings = QuantizedVector<uint8_t>(1.0f, 1, boxEncodings);
- QuantizedContainer quantScores = QuantizedVector<uint8_t>(0.01f, 0, scores);
+
+ QuantizedContainer quantBoxEncodings = armnnUtils::QuantizedVector<uint8_t>(boxEncodings, 1.00f, 1);
+ QuantizedContainer quantScores = armnnUtils::QuantizedVector<uint8_t>(scores, 0.01f, 0);
std::map<std::string, QuantizedContainer> input =
{
#include <boost/core/ignore_unused.hpp>
#include <boost/numeric/conversion/cast.hpp>
+namespace armnnUtils
+{
+
template<typename T, bool DoQuantize=true>
struct SelectiveQuantizer
{
template <typename T, typename FloatIt,
typename std::enable_if<IsFloatingPointIterator<FloatIt>::value, int>::type=0 // Makes sure fp iterator is valid.
>
-std::vector<T> QuantizedVector(float qScale, int32_t qOffset, FloatIt first, FloatIt last)
+std::vector<T> QuantizedVector(FloatIt first, FloatIt last, float qScale, int32_t qOffset)
{
std::vector<T> quantized;
quantized.reserve(boost::numeric_cast<size_t>(std::distance(first, last)));
for (auto it = first; it != last; ++it)
{
auto f = *it;
- T q =SelectiveQuantize<T>(f, qScale, qOffset);
+ T q = SelectiveQuantize<T>(f, qScale, qOffset);
quantized.push_back(q);
}
}
template<typename T>
-std::vector<T> QuantizedVector(float qScale, int32_t qOffset, const std::vector<float>& array)
+std::vector<T> QuantizedVector(const std::vector<float>& array, float qScale = 1.f, int32_t qOffset = 0)
{
- return QuantizedVector<T>(qScale, qOffset, array.begin(), array.end());
+ return QuantizedVector<T>(array.begin(), array.end(), qScale, qOffset);
}
template<typename T>
-std::vector<T> QuantizedVector(float qScale, int32_t qOffset, std::initializer_list<float> array)
+std::vector<T> QuantizedVector(std::initializer_list<float> array, float qScale = 1.f, int32_t qOffset = 0)
{
- return QuantizedVector<T>(qScale, qOffset, array.begin(), array.end());
+ return QuantizedVector<T>(array.begin(), array.end(), qScale, qOffset);
}
+
+} // namespace armnnUtils
--- /dev/null
+//
+// Copyright © 2019 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include <QuantizeHelper.hpp>
+
+#include <boost/core/ignore_unused.hpp>
+#include <boost/test/unit_test.hpp>
+
+#include <vector>
+
+BOOST_AUTO_TEST_SUITE(QuantizeHelper)
+
+namespace
+{
+
+template<typename T>
+bool IsFloatIterFunc(T iter)
+{
+ boost::ignore_unused(iter);
+ return armnnUtils::IsFloatingPointIterator<T>::value;
+}
+
+} // anonymous namespace
+
+BOOST_AUTO_TEST_CASE(IsFloatIterFuncTest)
+{
+ std::vector<float> fArray;
+ BOOST_TEST(IsFloatIterFunc(fArray.begin()) == true);
+ BOOST_TEST(IsFloatIterFunc(fArray.cbegin()) == true);
+
+ std::vector<double> dArray;
+ BOOST_TEST(IsFloatIterFunc(dArray.begin()) == true);
+
+ std::vector<int> iArray;
+ BOOST_TEST(IsFloatIterFunc(iArray.begin()) == false);
+
+ float floats[5];
+ BOOST_TEST(IsFloatIterFunc(&floats[0]) == true);
+
+ int ints[5];
+ BOOST_TEST(IsFloatIterFunc(&ints[0]) == false);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
#include "CommonTestUtils.hpp"
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <armnn/ArmNN.hpp>
};
// quantize data
- std::vector<T> qInputData = QuantizedVector<T>(qScale, qOffset, inputData);
- std::vector<T> qExpectedOutputData = QuantizedVector<T>(qScale, qOffset, expectedOutputData);
+ std::vector<T> qInputData = armnnUtils::QuantizedVector<T>(inputData, qScale, qOffset);
+ std::vector<T> qExpectedOutputData = armnnUtils::QuantizedVector<T>(expectedOutputData, qScale, qOffset);
INetworkPtr network = CreateAbsNetwork(tensorInfo);
OptimizeSubgraphViewTests.cpp
OptimizationViewsTests.cpp
PreluEndToEndTestImpl.hpp
- QuantizeHelper.hpp
QuantizedLstmEndToEndTestImpl.cpp
QuantizedLstmEndToEndTestImpl.hpp
ResizeEndToEndTestImpl.hpp
#include <armnn/ArmNN.hpp>
+#include <QuantizeHelper.hpp>
+
#include <backendsCommon/test/DataLayoutUtils.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
namespace
{
outputInfo.SetQuantizationOffset(qOffset);
}
- std::vector<T> inputData = QuantizedVector<T>(qScale, qOffset, floatInputData);
- std::vector<T> expectedOutputData = QuantizedVector<T>(qScale, qOffset, floatExpectedOutputData);
+ std::vector<T> inputData = armnnUtils::QuantizedVector<T>(floatInputData, qScale, qOffset);
+ std::vector<T> expectedOutputData = armnnUtils::QuantizedVector<T>(floatExpectedOutputData, qScale, qOffset);
// Permute tensors from NHWC to NCHW (if needed)
if (descriptor.m_DataLayout == DataLayout::NCHW)
//
#pragma once
-#include <ResolveType.hpp>
-
#include <armnn/ArmNN.hpp>
#include <armnn/INetwork.hpp>
-#include <Profiling.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
+#include <Profiling.hpp>
+#include <QuantizeHelper.hpp>
+#include <ResolveType.hpp>
#include <boost/test/unit_test.hpp>
return ConstantUsageTest(backends,
commonTensorInfo,
- QuantizedVector<uint8_t>(scale, offset, { 1.f, 2.f, 3.f, 4.f, 5.f, 6.f }), // Input.
- QuantizedVector<uint8_t>(scale, offset, { 6.f, 5.f, 4.f, 3.f, 2.f, 1.f }), // Const input.
- QuantizedVector<uint8_t>(scale, offset, { 7.f, 7.f, 7.f, 7.f, 7.f, 7.f }) // Expected output.
+ armnnUtils::QuantizedVector<uint8_t>({ 1.f, 2.f, 3.f, 4.f, 5.f, 6.f }, scale, offset), // Input.
+ armnnUtils::QuantizedVector<uint8_t>({ 6.f, 5.f, 4.f, 3.f, 2.f, 1.f }, scale, offset), // Const input.
+ armnnUtils::QuantizedVector<uint8_t>({ 7.f, 7.f, 7.f, 7.f, 7.f, 7.f }, scale, offset) // Expected output.
);
}
#include <armnn/ArmNN.hpp>
#include <Permute.hpp>
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <backendsCommon/test/CommonTestUtils.hpp>
}
// quantize data
- std::vector<T> qInputData = QuantizedVector<T>(qScale, qOffset, inputData);
- std::vector<T> qExpectedOutputData = QuantizedVector<T>(qScale, qOffset, expectedOutputData);
+ std::vector<T> qInputData = armnnUtils::QuantizedVector<T>(inputData, qScale, qOffset);
+ std::vector<T> qExpectedOutputData = armnnUtils::QuantizedVector<T>(expectedOutputData, qScale, qOffset);
INetworkPtr network = CreateResizeNetwork(descriptor, inputInfo, outputInfo);
armnn::DataLayout dataLayout)
{
ResizeEndToEnd<ArmnnType>(backends, dataLayout, armnn::ResizeMethod::NearestNeighbor);
-}
\ No newline at end of file
+}
#include <armnn/ArmNN.hpp>
#include <Permute.hpp>
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <backendsCommon/test/CommonTestUtils.hpp>
}
// quantize data
- std::vector<T> qInputData = QuantizedVector<T>(qScale, qOffset, inputData);
- std::vector<T> qWeightsData = QuantizedVector<T>(qScale, qOffset, weightsData);
- std::vector<T> qExpectedOutputData = QuantizedVector<T>(qScale, qOffset, expectedOutputData);
+ std::vector<T> qInputData = armnnUtils::QuantizedVector<T>(inputData, qScale, qOffset);
+ std::vector<T> qWeightsData = armnnUtils::QuantizedVector<T>(weightsData, qScale, qOffset);
+ std::vector<T> qExpectedOutputData = armnnUtils::QuantizedVector<T>(expectedOutputData, qScale, qOffset);
using BT = ResolveType<ArmnnBType>;
- std::vector<BT> qBiasesData = QuantizedVector<BT>(qScale * qScale, 0, biasesData);
+ std::vector<BT> qBiasesData = armnnUtils::QuantizedVector<BT>(biasesData, qScale * qScale, 0);
ConstTensor weights(weightsInfo, qWeightsData);
ConstTensor biases(biasesInfo, qBiasesData);
{ { 0, qInputData } },
{ { 0, qExpectedOutputData } },
backends);
-}
\ No newline at end of file
+}
#include "ActivationTestImpl.hpp"
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <armnn/ArmNN.hpp>
#include <backendsCommon/test/ActivationFixture.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
#include <backendsCommon/test/TensorCopyUtils.hpp>
#include <backendsCommon/test/WorkloadTestUtils.hpp>
LayerTestResult<T, 4> result(inputTensorInfo);
- auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(scale, offset, inputData));
+ auto input = MakeTensor<T, 4>(inputTensorInfo, armnnUtils::QuantizedVector<T>(inputData, scale, offset));
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
CopyDataFromITensorHandle(&result.output[0][0][0][0], outputHandle.get());
// Calculated manually.
- result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(outScale, outOffset,
- outputExpectedData));
+ result.outputExpected =
+ MakeTensor<T, 4>(outputTensorInfo, armnnUtils::QuantizedVector<T>(outputExpectedData, outScale, outOffset));
return result;
}
LayerTestResult<float, 5> result(inputTensorInfo);
- auto input = MakeTensor<float, 5>(inputTensorInfo, QuantizedVector<float>(0.f, 0.f, inputData));
+ auto input = MakeTensor<float, 5>(inputTensorInfo, inputData);
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
CopyDataFromITensorHandle(&result.output[0][0][0][0][0], outputHandle.get());
// Calculated manually.
- result.outputExpected = MakeTensor<float, 5>(outputTensorInfo, QuantizedVector<float>(0.f, 0.f,
- outputExpectedData));
+ result.outputExpected = MakeTensor<float, 5>(outputTensorInfo, outputExpectedData);
return result;
};
#include "ElementwiseTestImpl.hpp"
+#include <QuantizeHelper.hpp>
+
template<>
std::unique_ptr<armnn::IWorkload> CreateWorkload<armnn::AdditionQueueDescriptor>(
const armnn::IWorkloadFactory& workloadFactory,
outputTensorInfo.SetQuantizationOffset(qOffset);
}
- auto input1 = MakeTensor<T, 4>(inputTensorInfo1, QuantizedVector<T>(qScale, qOffset,
+ auto input1 = MakeTensor<T, 4>(inputTensorInfo1, armnnUtils::QuantizedVector<T>(
{
0.0f,
1.0f,
4.0f,
5.0f,
- }));
+ },
+ qScale, qOffset));
- auto input2 = MakeTensor<T, 4>(inputTensorInfo2, QuantizedVector<T>(qScale, qOffset,
+ auto input2 = MakeTensor<T, 4>(inputTensorInfo2, armnnUtils::QuantizedVector<T>(
{
0.5f, 1.5f, 2.5f,
3.5f, 4.5f, 5.5f,
- }));
+ },
+ qScale, qOffset));
LayerTestResult<T,4> ret(outputTensorInfo);
- ret.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset,
+ ret.outputExpected = MakeTensor<T, 4>(outputTensorInfo, armnnUtils::QuantizedVector<T>(
{
0.5f, 1.5f, 2.5f,
4.5f, 5.5f, 6.5f,
4.5f, 5.5f, 6.5f,
8.5f, 9.5f, 10.5f,
- }));
+ },
+ qScale, qOffset));
std::unique_ptr<armnn::ITensorHandle> inputHandle1 = workloadFactory.CreateTensorHandle(inputTensorInfo1);
std::unique_ptr<armnn::ITensorHandle> inputHandle2 = workloadFactory.CreateTensorHandle(inputTensorInfo2);
outputTensorInfo.SetQuantizationOffset(qOffset);
}
- auto input1 = MakeTensor<T, 4>(inputTensorInfo1, QuantizedVector<T>(qScale, qOffset,
+ auto input1 = MakeTensor<T, 4>(inputTensorInfo1, armnnUtils::QuantizedVector<T>(
{
- 0.0f, 1.0f, 2.0f,
- 3.0f, 4.0f, 5.0f,
- 6.0f, 7.0f, 8.0f,
- 9.0f, 10.0f, 11.0f,
+ 0.0f, 1.0f, 2.0f,
+ 3.0f, 4.0f, 5.0f,
+ 6.0f, 7.0f, 8.0f,
+ 9.0f, 10.0f, 11.0f,
12.0f, 13.0f, 14.0f,
15.0f, 16.0f, 17.0f,
- }));
+ },
+ qScale, qOffset));
- auto input2 = MakeTensor<T, 4>(inputTensorInfo2, QuantizedVector<T>(qScale, qOffset,
+ auto input2 = MakeTensor<T, 4>(inputTensorInfo2, armnnUtils::QuantizedVector<T>(
{
0.5f,
- }));
+ },
+ qScale, qOffset));
LayerTestResult<T,4> ret(outputTensorInfo);
- ret.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset,
+ ret.outputExpected = MakeTensor<T, 4>(outputTensorInfo, armnnUtils::QuantizedVector<T>(
{
- 0.5f, 1.5f, 2.5f,
- 3.5f, 4.5f, 5.5f,
- 6.5f, 7.5f, 8.5f,
- 9.5f, 10.5f, 11.5f,
+ 0.5f, 1.5f, 2.5f,
+ 3.5f, 4.5f, 5.5f,
+ 6.5f, 7.5f, 8.5f,
+ 9.5f, 10.5f, 11.5f,
12.5f, 13.5f, 14.5f,
15.5f, 16.5f, 17.5f,
- }));
+ },
+ qScale, qOffset));
std::unique_ptr<armnn::ITensorHandle> inputHandle1 = workloadFactory.CreateTensorHandle(inputTensorInfo1);
std::unique_ptr<armnn::ITensorHandle> inputHandle2 = workloadFactory.CreateTensorHandle(inputTensorInfo2);
#include "BatchNormalizationTestImpl.hpp"
#include <DataLayoutIndexed.hpp>
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <armnn/ArmNN.hpp>
#include <backendsCommon/IBackendInternal.hpp>
#include <backendsCommon/WorkloadFactory.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
#include <backendsCommon/test/TensorCopyUtils.hpp>
#include <backendsCommon/test/WorkloadTestUtils.hpp>
namespace
{
+using namespace armnnUtils;
+
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> BatchNormTestImpl(
armnn::IWorkloadFactory& workloadFactory,
tensorInfo.SetQuantizationOffset(qOffset);
}
- auto inputTensor = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, inputValues));
+ auto inputTensor = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(inputValues, qScale, qOffset));
// These values are per-channel of the input.
- auto mean = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>(qScale, qOffset, {3, -2}));
- auto variance = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>(qScale, qOffset, {4, 9}));
- auto beta = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>(qScale, qOffset, {3, 2}));
- auto gamma = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>(qScale, qOffset, {2, 1}));
+ auto mean = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>({ 3, -2 }, qScale, qOffset));
+ auto variance = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>({ 4, 9 }, qScale, qOffset));
+ auto beta = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>({ 3, 2 }, qScale, qOffset));
+ auto gamma = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>({ 2, 1 }, qScale, qOffset));
LayerTestResult<T, 4> result(outputTensorInfo);
result.outputExpected = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, expectedOutputValues));
+ QuantizedVector<T>(expectedOutputValues, qScale, qOffset));
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
}
auto input = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset,
+ QuantizedVector<T>(
{
1.f, 1.f, 4.f, 1.f,
4.f, 4.f, 2.f, 1.f,
1.f, -2.f, 6.f, 4.f
- }));
+ },
+ qScale, qOffset));
// These values are per-channel of the input.
- auto mean = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>(qScale, qOffset, {3, -2}));
- auto variance = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>(qScale, qOffset, {4, 9}));
- auto beta = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>(qScale, qOffset, {3, 2}));
- auto gamma = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>(qScale, qOffset, {2, 1}));
+ auto mean = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>({ 3, -2 }, qScale, qOffset));
+ auto variance = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>({ 4, 9 }, qScale, qOffset));
+ auto beta = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>({ 3, 2 }, qScale, qOffset));
+ auto gamma = MakeTensor<T, 1>(tensorInfo, QuantizedVector<T>({ 2, 1 }, qScale, qOffset));
LayerTestResult<T,4> ret(outputTensorInfo);
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
// substract mean, divide by standard deviation (with an epsilon to avoid div by 0),
// multiply by gamma and add beta
ret.outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset,
+ QuantizedVector<T>(
{
1.f, 3.f, 4.f, 3.f,
4.f, 4.f, 2.f, 3.f,
1.f, 2.f, 6.f, 4.f
- }));
+ },
+ qScale, qOffset));
std::unique_ptr<armnn::IWorkload> workload = workloadFactory.CreateBatchNormalization(data, info);
#include <armnn/ArmNN.hpp>
#include <Half.hpp>
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <backendsCommon/Workload.hpp>
#include <backendsCommon/WorkloadData.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
#include <backendsCommon/test/TensorCopyUtils.hpp>
#include <backendsCommon/test/WorkloadTestUtils.hpp>
{
using T = armnn::ResolveType<ArmnnInType>;
- std::vector<T> inputData0 = QuantizedVector<T>(quantScale, quantOffset, testData.m_InputData0);
- std::vector<T> inputData1 = QuantizedVector<T>(quantScale, quantOffset, testData.m_InputData1);
+ std::vector<T> inputData0 = armnnUtils::QuantizedVector<T>(testData.m_InputData0, quantScale, quantOffset);
+ std::vector<T> inputData1 = armnnUtils::QuantizedVector<T>(testData.m_InputData1, quantScale, quantOffset);
return ComparisonTestImpl<4, ArmnnInType>(
workloadFactory,
#include "ConcatTestImpl.hpp"
#include <Permute.hpp>
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <armnn/ArmNN.hpp>
#include <test/TensorHelpers.hpp>
+using namespace armnn;
+using namespace armnnUtils;
+
//
// Helper functions and templates
//
-armnn::OriginsDescriptor CreateDescriptorForConcat(
- const std::vector<armnn::TensorInfo> & inputTensorInfos,
+OriginsDescriptor CreateDescriptorForConcat(
+ const std::vector<TensorInfo> & inputTensorInfos,
unsigned int concatDim)
{
- std::vector<armnn::TensorShape> shapes;
+ std::vector<TensorShape> shapes;
shapes.reserve(inputTensorInfos.size());
- for (const armnn::TensorInfo& it: inputTensorInfos)
+ for (const TensorInfo& it: inputTensorInfos)
{
shapes.push_back(it.GetShape());
}
- return armnn::CreateDescriptorForConcatenation(shapes.begin(), shapes.end(), concatDim);
+ return CreateDescriptorForConcatenation(shapes.begin(), shapes.end(), concatDim);
}
//
//
bool NeedPermuteForConcat(
- const std::vector<armnn::TensorInfo> & inputTensorInfos,
+ const std::vector<TensorInfo> & inputTensorInfos,
unsigned int concatDim)
{
// See note above. Additionally we expect the input shapes to have the
return (nDimensions < 3 || (nDimensions == 3 && (nDimensions-concatDim) < 3 && (nDimensions-concatDim) != 1));
}
-armnn::TensorShape ExpandTensorShapeTo3dForPermute(const armnn::TensorShape & inputShape)
+TensorShape ExpandTensorShapeTo3dForPermute(const TensorShape & inputShape)
{
unsigned int numDims = inputShape.GetNumDimensions();
if (numDims >= 3)
{
newDims[expandedBy+i] = inputShape[i];
}
- return armnn::TensorShape(3u, &newDims[0]);
+ return TensorShape(3u, &newDims[0]);
}
void Generate3dPermuteVectorForConcat(
unsigned int numDimensions,
unsigned int & concatDim,
- std::pair<armnn::PermutationVector, armnn::PermutationVector> & permutations)
+ std::pair<PermutationVector, PermutationVector> & permutations)
{
BOOST_ASSERT_MSG(numDimensions <= 3,
"Only dimensions 1,2 and 3 are supported by this helper");
if (expandedConcatAxis == 2)
{
concatDim = 0;
- armnn::PermutationVector forwardPermutation({1, 2, 0});
- armnn::PermutationVector reversePermutation({2, 0, 1});
+ PermutationVector forwardPermutation({1, 2, 0});
+ PermutationVector reversePermutation({2, 0, 1});
permutations = std::make_pair(forwardPermutation, reversePermutation);
}
else if (expandedConcatAxis == 1)
{
concatDim = 0;
- armnn::PermutationVector forwardPermutation({2, 0, 1});
- armnn::PermutationVector reversePermutation({1, 2, 0});
+ PermutationVector forwardPermutation({2, 0, 1});
+ PermutationVector reversePermutation({1, 2, 0});
permutations = std::make_pair(forwardPermutation, reversePermutation);
}
else
}
template<typename T> void PermuteTensorData(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
- const armnn::PermutationVector& mappings,
- armnn::TensorInfo & inputTensorInfo,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const PermutationVector& mappings,
+ TensorInfo & inputTensorInfo,
const T * inputData,
std::vector<T>& outputData)
{
return;
}
- armnn::TensorInfo outputTensorInfo = armnnUtils::Permuted(inputTensorInfo, mappings);
+ TensorInfo outputTensorInfo = armnnUtils::Permuted(inputTensorInfo, mappings);
- std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
- std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
+ std::unique_ptr<ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
+ std::unique_ptr<ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
- armnn::PermuteQueueDescriptor queueDescriptor;
- queueDescriptor.m_Parameters = armnn::PermuteDescriptor{mappings};
- armnn::WorkloadInfo workloadInfo;
+ PermuteQueueDescriptor queueDescriptor;
+ queueDescriptor.m_Parameters = PermuteDescriptor{mappings};
+ WorkloadInfo workloadInfo;
AddInputToWorkload(queueDescriptor, workloadInfo, inputTensorInfo, inputHandle.get());
AddOutputToWorkload(queueDescriptor, workloadInfo, outputTensorInfo, outputHandle.get());
- std::unique_ptr<armnn::IWorkload> workload = workloadFactory.CreatePermute(queueDescriptor, workloadInfo);
+ std::unique_ptr<IWorkload> workload = workloadFactory.CreatePermute(queueDescriptor, workloadInfo);
inputHandle->Allocate();
outputHandle->Allocate();
// of the permuted concatenated tensor is going to be.
//
template<typename T> void PermuteInputsForConcat(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
- std::vector<armnn::TensorInfo> & inputTensorInfos,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ std::vector<TensorInfo> & inputTensorInfos,
std::vector<T *> & inputData,
std::vector<std::vector<T>> & inputDataStorage,
- armnn::PermutationVector & permuteVector,
+ PermutationVector & permuteVector,
unsigned int & concatDim,
- armnn::TensorInfo & outputTensorInfo)
+ TensorInfo & outputTensorInfo)
{
BOOST_ASSERT_MSG(inputTensorInfos.size() > 1,
"Expecting more than one tensor to be concatenated here");
unsigned int numDims = 0;
unsigned int nthInput = 0;
- const armnn::PermutationVector identity({0, 1, 2});
+ const PermutationVector identity({0, 1, 2});
- std::pair<armnn::PermutationVector, armnn::PermutationVector> permutations =
+ std::pair<PermutationVector, PermutationVector> permutations =
std::make_pair(identity, identity);
inputDataStorage.resize(inputData.size());
"All inputs must have the same number of dimensions");
}
- armnn::TensorInfo newTensorInfo = tensorInfo;
+ TensorInfo newTensorInfo = tensorInfo;
newTensorInfo.SetShape(ExpandTensorShapeTo3dForPermute(tensorInfo.GetShape()));
PermuteTensorData<T>(workloadFactory,
// output.
//
template <typename T> void PermuteOutputForConcat(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
- const armnn::TensorInfo & tensorInfo,
- const armnn::PermutationVector & permuteVector,
- std::unique_ptr<armnn::ITensorHandle> && inputDataHandle,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const TensorInfo & tensorInfo,
+ const PermutationVector & permuteVector,
+ std::unique_ptr<ITensorHandle> && inputDataHandle,
T * data)
{
BOOST_ASSERT_MSG(data != nullptr, "data must not be null");
return;
}
- armnn::TensorInfo resultTensorInfo = tensorInfo;
+ TensorInfo resultTensorInfo = tensorInfo;
std::vector<T> inputData(tensorInfo.GetNumElements());
std::vector<T> outputData;
}
template<typename T> void Concatenate(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
- std::initializer_list<const armnn::TensorInfo> inputTensorInfosOrig,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ std::initializer_list<const TensorInfo> inputTensorInfosOrig,
std::initializer_list<T *> inputsOrig,
- const armnn::TensorInfo& outputTensorInfoOrig,
+ const TensorInfo& outputTensorInfoOrig,
T * output,
unsigned int concatDim,
bool useSubtensor)
}
// Saves a copy of the parameters which we might need to change.
- std::vector<armnn::TensorInfo> inputTensorInfos(inputTensorInfosOrig.begin(), inputTensorInfosOrig.end());
+ std::vector<TensorInfo> inputTensorInfos(inputTensorInfosOrig.begin(), inputTensorInfosOrig.end());
std::vector<T *> inputs = inputsOrig;
- armnn::TensorInfo outputTensorInfo = outputTensorInfoOrig;
+ TensorInfo outputTensorInfo = outputTensorInfoOrig;
- armnn::PermutationVector permuteVector{0, 1, 2};
+ PermutationVector permuteVector{0, 1, 2};
// Holds and automatically releases memory for the reshaped input data.
std::vector<std::vector<T>> tmpInputDataStorage;
outputTensorInfo);
}
- armnn::WorkloadInfo workloadInfo;
+ WorkloadInfo workloadInfo;
- std::vector<std::unique_ptr<armnn::ITensorHandle>> inputHandles;
+ std::vector<std::unique_ptr<ITensorHandle>> inputHandles;
inputHandles.reserve(inputCount);
- std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
+ std::unique_ptr<ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
- armnn::ConcatQueueDescriptor queueDescriptor;
- armnn::OriginsDescriptor viewsDescriptor = CreateDescriptorForConcat(inputTensorInfos, concatDim);
+ ConcatQueueDescriptor queueDescriptor;
+ OriginsDescriptor viewsDescriptor = CreateDescriptorForConcat(inputTensorInfos, concatDim);
queueDescriptor.m_Parameters = viewsDescriptor;
if (useSubtensor)
const bool subTensorsSupported = workloadFactory.SupportsSubTensors();
for (unsigned int i = 0; i < inputCount; ++i)
{
- const armnn::TensorInfo& inputTensorInfo = inputTensorInfos[i];
- std::unique_ptr<armnn::ITensorHandle> inputHandle =
+ const TensorInfo& inputTensorInfo = inputTensorInfos[i];
+ std::unique_ptr<ITensorHandle> inputHandle =
subTensorsSupported ?
workloadFactory.CreateSubTensorHandle(*outputHandle,
inputTensorInfo.GetShape(),
{
for (unsigned int i = 0; i < inputCount; ++i)
{
- std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfos[i]);
+ std::unique_ptr<ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfos[i]);
inputHandles.emplace_back(std::move(inputHandle));
}
}
AddOutputToWorkload(queueDescriptor, workloadInfo, outputTensorInfo, outputHandle.get());
- std::unique_ptr<armnn::IWorkload> workload = workloadFactory.CreateConcat(queueDescriptor, workloadInfo);
+ std::unique_ptr<IWorkload> workload = workloadFactory.CreateConcat(queueDescriptor, workloadInfo);
for (auto& inputHandle : inputHandles)
{
// Implementation templates
//
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 1> Concat1dTestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo inputTensorInfo({ 3 }, ArmnnType, qScale, qOffset);
+ TensorInfo inputTensorInfo({ 3 }, ArmnnType, qScale, qOffset);
- auto input0 = MakeTensor<T, 1>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, { 1.0f, 2.0f, 3.0f }));
- auto input1 = MakeTensor<T, 1>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, { 4.0f, 5.0f, 6.0f }));
- auto input2 = MakeTensor<T, 1>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, { 7.0f, 8.0f, 9.0f }));
+ auto input0 = MakeTensor<T, 1>(inputTensorInfo, QuantizedVector<T>({ 1.0f, 2.0f, 3.0f }, qScale, qOffset));
+ auto input1 = MakeTensor<T, 1>(inputTensorInfo, QuantizedVector<T>({ 4.0f, 5.0f, 6.0f }, qScale, qOffset));
+ auto input2 = MakeTensor<T, 1>(inputTensorInfo, QuantizedVector<T>({ 7.0f, 8.0f, 9.0f }, qScale, qOffset));
- armnn::TensorInfo outputTensorInfo({ 9 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 9 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 1> result(outputTensorInfo);
0,
true);
- result.output = MakeTensor<T, 1>(outputTensorInfo, output);
- result.outputExpected = MakeTensor<T, 1>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f
- }));
+ result.output = MakeTensor<T, 1>(outputTensorInfo, output);
+ result.outputExpected = MakeTensor<T, 1>(outputTensorInfo, QuantizedVector<T>(
+ {
+ 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 2> Concat2dTestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
- const armnn::TensorInfo& outputTensorInfo,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const TensorInfo& outputTensorInfo,
unsigned int dimension,
const float qScale,
const int32_t qOffset)
{
- armnn::TensorInfo inputTensorInfo({ 2, 3 }, ArmnnType, qScale, qOffset);
+ TensorInfo inputTensorInfo({ 2, 3 }, ArmnnType, qScale, qOffset);
- auto input0 = MakeTensor<T, 2>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0
- 1.0f, 2.0f, 3.0f,
+ auto input0 = MakeTensor<T, 2>(inputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0
+ 1.0f, 2.0f, 3.0f,
- // Batch 1
- 10.0f, 11.0f, 12.0f,
- }));
+ // Batch 1
+ 10.0f, 11.0f, 12.0f,
+ },
+ qScale, qOffset));
- auto input1 = MakeTensor<T, 2>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0
- 4.0f, 5.0f, 6.0f,
+ auto input1 = MakeTensor<T, 2>(inputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0
+ 4.0f, 5.0f, 6.0f,
- // Batch 1
- 13.0f, 14.0f, 15.0f,
- }));
+ // Batch 1
+ 13.0f, 14.0f, 15.0f,
+ },
+ qScale, qOffset));
- auto input2 = MakeTensor<T, 2>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0
- 7.0f, 8.0f, 9.0f,
+ auto input2 = MakeTensor<T, 2>(inputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0
+ 7.0f, 8.0f, 9.0f,
- // Batch 1
- 16.0f, 17.0f, 18.0f,
- }));
+ // Batch 1
+ 16.0f, 17.0f, 18.0f,
+ },
+ qScale, qOffset));
LayerTestResult<T, 2> result(outputTensorInfo);
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 2> Concat2dDim0TestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo outputTensorInfo({ 6, 3 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 6, 3 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 2> result = Concat2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, outputTensorInfo, 0, qScale, qOffset);
- result.outputExpected = MakeTensor<T, 2>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0
- 1.0f, 2.0f, 3.0f,
+ result.outputExpected = MakeTensor<T, 2>(outputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0
+ 1.0f, 2.0f, 3.0f,
- // Batch 1
- 10.0f, 11.0f, 12.0f,
+ // Batch 1
+ 10.0f, 11.0f, 12.0f,
- // Batch 2
- 4.0f, 5.0f, 6.0f,
+ // Batch 2
+ 4.0f, 5.0f, 6.0f,
- // Batch 3
- 13.0f, 14.0f, 15.0f,
+ // Batch 3
+ 13.0f, 14.0f, 15.0f,
- // Batch 4
- 7.0f, 8.0f, 9.0f,
+ // Batch 4
+ 7.0f, 8.0f, 9.0f,
- // Batch 5
- 16.0f, 17.0f, 18.0f,
- }));
+ // Batch 5
+ 16.0f, 17.0f, 18.0f,
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 2> Concat2dDim1TestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo outputTensorInfo({ 2, 9 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 2, 9 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 2> result = Concat2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, outputTensorInfo, 1, qScale, qOffset);
- result.outputExpected = MakeTensor<T, 2>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0
- 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f,
+ result.outputExpected = MakeTensor<T, 2>(outputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0
+ 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f,
- // Batch 1
- 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f
- }));
+ // Batch 1
+ 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 2> Concat2dDim0DiffInputDimsTestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo input0TensorInfo({ 2, 3 }, ArmnnType, qScale, qOffset);
- auto input0 = MakeTensor<T, 2>(input0TensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0
- 1.0f, 2.0f, 3.0f,
+ TensorInfo input0TensorInfo({ 2, 3 }, ArmnnType, qScale, qOffset);
+ auto input0 = MakeTensor<T, 2>(input0TensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0
+ 1.0f, 2.0f, 3.0f,
- // Batch 1
- 10.0f, 11.0f, 12.0f,
- }));
+ // Batch 1
+ 10.0f, 11.0f, 12.0f,
+ },
+ qScale, qOffset));
- armnn::TensorInfo input1TensorInfo({ 3, 3 }, ArmnnType, qScale, qOffset);
- auto input1 = MakeTensor<T, 2>(input1TensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0
- 4.0f, 5.0f, 6.0f,
+ TensorInfo input1TensorInfo({ 3, 3 }, ArmnnType, qScale, qOffset);
+ auto input1 = MakeTensor<T, 2>(input1TensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0
+ 4.0f, 5.0f, 6.0f,
- // Batch 1
- 13.0f, 14.0f, 15.0f,
+ // Batch 1
+ 13.0f, 14.0f, 15.0f,
- // Batch 0
- 7.0f, 8.0f, 9.0f,
- }));
+ // Batch 0
+ 7.0f, 8.0f, 9.0f,
+ },
+ qScale, qOffset));
- armnn::TensorInfo input2TensorInfo({ 1, 3 }, ArmnnType, qScale, qOffset);
- auto input2 = MakeTensor<T, 2>(input2TensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 1
- 16.0f, 17.0f, 18.0f,
- }));
+ TensorInfo input2TensorInfo({ 1, 3 }, ArmnnType, qScale, qOffset);
+ auto input2 = MakeTensor<T, 2>(input2TensorInfo, QuantizedVector<T>(
+ {
+ // Batch 1
+ 16.0f, 17.0f, 18.0f,
+ },
+ qScale, qOffset));
- armnn::TensorInfo outputTensorInfo({ 6, 3 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 6, 3 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 2> result(outputTensorInfo);
std::vector<T> output;
true);
result.output = MakeTensor<T, 2>(outputTensorInfo, output);
- result.outputExpected = MakeTensor<T, 2>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0
- 1.0f, 2.0f, 3.0f,
+ result.outputExpected = MakeTensor<T, 2>(outputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0
+ 1.0f, 2.0f, 3.0f,
- // Batch 1
- 10.0f, 11.0f, 12.0f,
+ // Batch 1
+ 10.0f, 11.0f, 12.0f,
- // Batch 2
- 4.0f, 5.0f, 6.0f,
+ // Batch 2
+ 4.0f, 5.0f, 6.0f,
- // Batch 3
- 13.0f, 14.0f, 15.0f,
+ // Batch 3
+ 13.0f, 14.0f, 15.0f,
- // Batch 4
- 7.0f, 8.0f, 9.0f,
+ // Batch 4
+ 7.0f, 8.0f, 9.0f,
- // Batch 5
- 16.0f, 17.0f, 18.0f,
- }));
+ // Batch 5
+ 16.0f, 17.0f, 18.0f,
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 2> Concat2dDim1DiffInputDimsTestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo input0TensorInfo({ 2, 3 }, ArmnnType, qScale, qOffset);
- auto input0 = MakeTensor<T, 2>(input0TensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0
- 1.0f, 2.0f, 3.0f,
+ TensorInfo input0TensorInfo({ 2, 3 }, ArmnnType, qScale, qOffset);
+ auto input0 = MakeTensor<T, 2>(input0TensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0
+ 1.0f, 2.0f, 3.0f,
- // Batch 1
- 10.0f, 11.0f, 12.0f,
- }));
+ // Batch 1
+ 10.0f, 11.0f, 12.0f,
+ },
+ qScale, qOffset));
- armnn::TensorInfo input1TensorInfo({ 2, 5 }, ArmnnType, qScale, qOffset);
- auto input1 = MakeTensor<T, 2>(input1TensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0
- 4.0f, 5.0f, 6.0f, 7.0f, 8.0f,
+ TensorInfo input1TensorInfo({ 2, 5 }, ArmnnType, qScale, qOffset);
+ auto input1 = MakeTensor<T, 2>(input1TensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0
+ 4.0f, 5.0f, 6.0f, 7.0f, 8.0f,
- // Batch 1
- 13.0f, 14.0f, 15.0f, 16.0f, 17.0f,
- }));
+ // Batch 1
+ 13.0f, 14.0f, 15.0f, 16.0f, 17.0f,
+ },
+ qScale, qOffset));
- armnn::TensorInfo input2TensorInfo({ 2, 1 }, ArmnnType, qScale, qOffset);
- auto input2 = MakeTensor<T, 2>(input2TensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0
- 9.0f,
+ TensorInfo input2TensorInfo({ 2, 1 }, ArmnnType, qScale, qOffset);
+ auto input2 = MakeTensor<T, 2>(input2TensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0
+ 9.0f,
- // Batch 1
- 18.0f
- }));
+ // Batch 1
+ 18.0f
+ },
+ qScale, qOffset));
- armnn::TensorInfo outputTensorInfo({ 2, 9 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 2, 9 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 2> result(outputTensorInfo);
std::vector<T> output;
true);
result.output = MakeTensor<T, 2>(outputTensorInfo, output);
- result.outputExpected = MakeTensor<T, 2>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0
- 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f,
+ result.outputExpected = MakeTensor<T, 2>(outputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0
+ 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f,
- // Batch 1
- 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f,
- }));
+ // Batch 1
+ 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f,
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 3> Concat3dTestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
- const armnn::TensorInfo& outputTensorInfo,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const TensorInfo& outputTensorInfo,
unsigned int dimension,
bool useSubtensor,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo inputTensorInfo({ 2, 3, 2 }, ArmnnType, qScale, qOffset);
+ TensorInfo inputTensorInfo({ 2, 3, 2 }, ArmnnType, qScale, qOffset);
- auto input0 = MakeTensor<T, 3>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 1.0f, 2.0f,
+ auto input0 = MakeTensor<T, 3>(inputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 1.0f, 2.0f,
- // Batch 0, Channel 1
- 3.0f, 4.0f,
+ // Batch 0, Channel 1
+ 3.0f, 4.0f,
- // Batch 0, Channel 2
- 5.0f, 6.0f,
+ // Batch 0, Channel 2
+ 5.0f, 6.0f,
- // Batch 1, Channel 0
- 19.0f, 20.0f,
+ // Batch 1, Channel 0
+ 19.0f, 20.0f,
- // Batch 1, Channel 1
- 21.0f, 22.0f,
+ // Batch 1, Channel 1
+ 21.0f, 22.0f,
- // Batch 1, Channel 2
- 23.0f, 24.0f
- }));
+ // Batch 1, Channel 2
+ 23.0f, 24.0f
+ },
+ qScale, qOffset));
- auto input1 = MakeTensor<T, 3>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 7.0f, 8.0f,
+ auto input1 = MakeTensor<T, 3>(inputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 7.0f, 8.0f,
- // Batch 0, Channel 1
- 9.0f, 10.0f,
+ // Batch 0, Channel 1
+ 9.0f, 10.0f,
- // Batch 0, Channel 2
- 11.0f, 12.0f,
+ // Batch 0, Channel 2
+ 11.0f, 12.0f,
- // Batch 1, Channel 0
- 25.0f, 26.0f,
+ // Batch 1, Channel 0
+ 25.0f, 26.0f,
- // Batch 1, Channel 1
- 27.0f, 28.0f,
+ // Batch 1, Channel 1
+ 27.0f, 28.0f,
- // Batch 1, Channel 2
- 29.0f, 30.0f
- }));
+ // Batch 1, Channel 2
+ 29.0f, 30.0f
+ },
+ qScale, qOffset));
- auto input2 = MakeTensor<T, 3>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 13.0f, 14.0f,
+ auto input2 = MakeTensor<T, 3>(inputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 13.0f, 14.0f,
- // Batch 0, Channel 1
- 15.0f, 16.0f,
+ // Batch 0, Channel 1
+ 15.0f, 16.0f,
- // Batch 0, Channel 2
- 17.0f, 18.0f,
+ // Batch 0, Channel 2
+ 17.0f, 18.0f,
- // Batch 1, Channel 0
- 31.0f, 32.0f,
+ // Batch 1, Channel 0
+ 31.0f, 32.0f,
- // Batch 1, Channel 1
- 33.0f, 34.0f,
+ // Batch 1, Channel 1
+ 33.0f, 34.0f,
- // Batch 1, Channel 2
- 35.0f, 36.0f
- }));
+ // Batch 1, Channel 2
+ 35.0f, 36.0f
+ },
+ qScale, qOffset));
LayerTestResult<T, 3> result(outputTensorInfo);
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 3> Concat3dDim0TestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo outputTensorInfo({ 6, 3, 2 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 6, 3, 2 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 3> result = Concat3dTestImpl<ArmnnType>(
workloadFactory, memoryManager, outputTensorInfo, 0, true, qScale, qOffset);
- result.outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 1.0f, 2.0f,
+ result.outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 1.0f, 2.0f,
- // Batch 0, Channel 1
- 3.0f, 4.0f,
+ // Batch 0, Channel 1
+ 3.0f, 4.0f,
- // Batch 0, Channel 2
- 5.0f, 6.0f,
+ // Batch 0, Channel 2
+ 5.0f, 6.0f,
- // Batch 1, Channel 0
- 19.0f, 20.0f,
+ // Batch 1, Channel 0
+ 19.0f, 20.0f,
- // Batch 1, Channel 1
- 21.0f, 22.0f,
+ // Batch 1, Channel 1
+ 21.0f, 22.0f,
- // Batch 1, Channel 2
- 23.0f, 24.0f,
+ // Batch 1, Channel 2
+ 23.0f, 24.0f,
- // Batch 2, Channel 0
- 7.0f, 8.0f,
+ // Batch 2, Channel 0
+ 7.0f, 8.0f,
- // Batch 2, Channel 1
- 9.0f, 10.0f,
+ // Batch 2, Channel 1
+ 9.0f, 10.0f,
- // Batch 2, Channel 2
- 11.0f, 12.0f,
+ // Batch 2, Channel 2
+ 11.0f, 12.0f,
- // Batch 3, Channel 0
- 25.0f, 26.0f,
+ // Batch 3, Channel 0
+ 25.0f, 26.0f,
- // Batch 3, Channel 1
- 27.0f, 28.0f,
+ // Batch 3, Channel 1
+ 27.0f, 28.0f,
- // Batch 3, Channel 2
- 29.0f, 30.0f,
+ // Batch 3, Channel 2
+ 29.0f, 30.0f,
- // Batch 4, Channel 0
- 13.0f, 14.0f,
+ // Batch 4, Channel 0
+ 13.0f, 14.0f,
- // Batch 4, Channel 1
- 15.0f, 16.0f,
+ // Batch 4, Channel 1
+ 15.0f, 16.0f,
- // Batch 4, Channel 2
- 17.0f, 18.0f,
+ // Batch 4, Channel 2
+ 17.0f, 18.0f,
- // Batch 5, Channel 0
- 31.0f, 32.0f,
+ // Batch 5, Channel 0
+ 31.0f, 32.0f,
- // Batch 5, Channel 1
- 33.0f, 34.0f,
+ // Batch 5, Channel 1
+ 33.0f, 34.0f,
- // Batch 5, Channel 2
- 35.0f, 36.0f
- }));
+ // Batch 5, Channel 2
+ 35.0f, 36.0f
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 3> Concat3dDim1TestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo outputTensorInfo({ 2, 9, 2 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 2, 9, 2 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 3> result = Concat3dTestImpl<ArmnnType>(
workloadFactory, memoryManager, outputTensorInfo, 1, true, qScale, qOffset);
- result.outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 1.0f, 2.0f,
+ result.outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 1.0f, 2.0f,
- // Batch 0, Channel 1
- 3.0f, 4.0f,
+ // Batch 0, Channel 1
+ 3.0f, 4.0f,
- // Batch 0, Channel 2
- 5.0f, 6.0f,
+ // Batch 0, Channel 2
+ 5.0f, 6.0f,
- // Batch 0, Channel 3
- 7.0f, 8.0f,
+ // Batch 0, Channel 3
+ 7.0f, 8.0f,
- // Batch 0, Channel 4
- 9.0f, 10.0f,
+ // Batch 0, Channel 4
+ 9.0f, 10.0f,
- // Batch 0, Channel 5
- 11.0f, 12.0f,
+ // Batch 0, Channel 5
+ 11.0f, 12.0f,
- // Batch 0, Channel 6
- 13.0f, 14.0f,
+ // Batch 0, Channel 6
+ 13.0f, 14.0f,
- // Batch 0, Channel 7
- 15.0f, 16.0f,
+ // Batch 0, Channel 7
+ 15.0f, 16.0f,
- // Batch 0, Channel 8
- 17.0f, 18.0f,
+ // Batch 0, Channel 8
+ 17.0f, 18.0f,
- // Batch 1, Channel 0
- 19.0f, 20.0f,
+ // Batch 1, Channel 0
+ 19.0f, 20.0f,
- // Batch 1, Channel 1
- 21.0f, 22.0f,
+ // Batch 1, Channel 1
+ 21.0f, 22.0f,
- // Batch 1, Channel 2
- 23.0f, 24.0f,
+ // Batch 1, Channel 2
+ 23.0f, 24.0f,
- // Batch 1, Channel 3
- 25.0f, 26.0f,
+ // Batch 1, Channel 3
+ 25.0f, 26.0f,
- // Batch 1, Channel 4
- 27.0f, 28.0f,
+ // Batch 1, Channel 4
+ 27.0f, 28.0f,
- // Batch 1, Channel 5
- 29.0f, 30.0f,
+ // Batch 1, Channel 5
+ 29.0f, 30.0f,
- // Batch 1, Channel 6
- 31.0f, 32.0f,
+ // Batch 1, Channel 6
+ 31.0f, 32.0f,
- // Batch 1, Channel 7
- 33.0f, 34.0f,
+ // Batch 1, Channel 7
+ 33.0f, 34.0f,
- // Batch 1, Channel 8
- 35.0f, 36.0f
- }));
+ // Batch 1, Channel 8
+ 35.0f, 36.0f
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 3> Concat3dDim2TestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
bool useSubtensor,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo outputTensorInfo({ 2, 3, 6 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 2, 3, 6 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 3> result = Concat3dTestImpl<ArmnnType>(
workloadFactory, memoryManager, outputTensorInfo, 2, useSubtensor, qScale, qOffset);
- result.outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 1.0f, 2.0f, 7.0f, 8.0f, 13.0f, 14.0f,
+ result.outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 1.0f, 2.0f, 7.0f, 8.0f, 13.0f, 14.0f,
- // Batch 0, Channel 1
- 3.0f, 4.0f, 9.0f, 10.0f, 15.0f, 16.0f,
+ // Batch 0, Channel 1
+ 3.0f, 4.0f, 9.0f, 10.0f, 15.0f, 16.0f,
- // Batch 0, Channel 2
- 5.0f, 6.0f, 11.0f, 12.0f, 17.0f, 18.0f,
+ // Batch 0, Channel 2
+ 5.0f, 6.0f, 11.0f, 12.0f, 17.0f, 18.0f,
- // Batch 1, Channel 0
- 19.0f, 20.0f, 25.0f, 26.0f, 31.0f, 32.0f,
+ // Batch 1, Channel 0
+ 19.0f, 20.0f, 25.0f, 26.0f, 31.0f, 32.0f,
- // Batch 1, Channel 1
- 21.0f, 22.0f, 27.0f, 28.0f, 33.0f, 34.0f,
+ // Batch 1, Channel 1
+ 21.0f, 22.0f, 27.0f, 28.0f, 33.0f, 34.0f,
- // Batch 1, Channel 2
- 23.0f, 24.0f, 29.0f, 30.0f, 35.0f, 36.0f,
- }));
+ // Batch 1, Channel 2
+ 23.0f, 24.0f, 29.0f, 30.0f, 35.0f, 36.0f,
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 3> Concat3dDim0DiffInputDimsTestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo input0TensorInfo({ 2, 3, 2 }, ArmnnType);
- auto input0 = MakeTensor<T, 3>(input0TensorInfo, QuantizedVector<T>(qScale, qOffset, {
+ TensorInfo input0TensorInfo({ 2, 3, 2 }, ArmnnType);
+ auto input0 = MakeTensor<T, 3>(input0TensorInfo, QuantizedVector<T>(
+ {
// Batch 0, Channel 0
1.0f, 2.0f,
// Batch 1, Channel 2
23.0f, 24.0f
- }));
+ },
+ qScale, qOffset));
- armnn::TensorInfo input1TensorInfo({ 1, 3, 2 }, ArmnnType);
- auto input1 = MakeTensor<T, 3>(input1TensorInfo, QuantizedVector<T>(qScale, qOffset, {
+ TensorInfo input1TensorInfo({ 1, 3, 2 }, ArmnnType);
+ auto input1 = MakeTensor<T, 3>(input1TensorInfo, QuantizedVector<T>(
+ {
// Batch 0, Channel 0
7.0f, 8.0f,
// Batch 0, Channel 2
11.0f, 12.0f,
- }));
+ },
+ qScale, qOffset));
- armnn::TensorInfo input2TensorInfo({ 3, 3, 2 }, ArmnnType);
- auto input2 = MakeTensor<T, 3>(input2TensorInfo, QuantizedVector<T>(qScale, qOffset, {
+ TensorInfo input2TensorInfo({ 3, 3, 2 }, ArmnnType);
+ auto input2 = MakeTensor<T, 3>(input2TensorInfo, QuantizedVector<T>(
+ {
// Batch 0, Channel 0
25.0f, 26.0f,
// Batch 2, Channel 2
35.0f, 36.0f
- }));
+ },
+ qScale, qOffset));
- armnn::TensorInfo outputTensorInfo({ 6, 3, 2 }, ArmnnType);
+ TensorInfo outputTensorInfo({ 6, 3, 2 }, ArmnnType);
LayerTestResult<T, 3> result(outputTensorInfo);
std::vector<T> output;
true);
result.output = MakeTensor<T, 3>(outputTensorInfo, output);
- result.outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 1.0f, 2.0f,
+ result.outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 1.0f, 2.0f,
- // Batch 0, Channel 1
- 3.0f, 4.0f,
+ // Batch 0, Channel 1
+ 3.0f, 4.0f,
- // Batch 0, Channel 2
- 5.0f, 6.0f,
+ // Batch 0, Channel 2
+ 5.0f, 6.0f,
- // Batch 1, Channel 0
- 19.0f, 20.0f,
+ // Batch 1, Channel 0
+ 19.0f, 20.0f,
- // Batch 1, Channel 1
- 21.0f, 22.0f,
+ // Batch 1, Channel 1
+ 21.0f, 22.0f,
- // Batch 1, Channel 2
- 23.0f, 24.0f,
+ // Batch 1, Channel 2
+ 23.0f, 24.0f,
- // Batch 2, Channel 0
- 7.0f, 8.0f,
+ // Batch 2, Channel 0
+ 7.0f, 8.0f,
- // Batch 2, Channel 1
- 9.0f, 10.0f,
+ // Batch 2, Channel 1
+ 9.0f, 10.0f,
- // Batch 2, Channel 2
- 11.0f, 12.0f,
+ // Batch 2, Channel 2
+ 11.0f, 12.0f,
- // Batch 3, Channel 0
- 25.0f, 26.0f,
+ // Batch 3, Channel 0
+ 25.0f, 26.0f,
- // Batch 3, Channel 1
- 27.0f, 28.0f,
+ // Batch 3, Channel 1
+ 27.0f, 28.0f,
- // Batch 3, Channel 2
- 29.0f, 30.0f,
+ // Batch 3, Channel 2
+ 29.0f, 30.0f,
- // Batch 4, Channel 0
- 13.0f, 14.0f,
+ // Batch 4, Channel 0
+ 13.0f, 14.0f,
- // Batch 4, Channel 1
- 15.0f, 16.0f,
+ // Batch 4, Channel 1
+ 15.0f, 16.0f,
- // Batch 4, Channel 2
- 17.0f, 18.0f,
+ // Batch 4, Channel 2
+ 17.0f, 18.0f,
- // Batch 5, Channel 0
- 31.0f, 32.0f,
+ // Batch 5, Channel 0
+ 31.0f, 32.0f,
- // Batch 5, Channel 1
- 33.0f, 34.0f,
+ // Batch 5, Channel 1
+ 33.0f, 34.0f,
- // Batch 5, Channel 2
- 35.0f, 36.0f
- }));
+ // Batch 5, Channel 2
+ 35.0f, 36.0f
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 3> Concat3dDim1DiffInputDimsTestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo input0TensorInfo({ 2, 3, 2 }, ArmnnType, qScale, qOffset);
- auto input0 = MakeTensor<T, 3>(input0TensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 1.0f, 2.0f,
+ TensorInfo input0TensorInfo({ 2, 3, 2 }, ArmnnType, qScale, qOffset);
+ auto input0 = MakeTensor<T, 3>(input0TensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 1.0f, 2.0f,
- // Batch 0, Channel 1
- 3.0f, 4.0f,
+ // Batch 0, Channel 1
+ 3.0f, 4.0f,
- // Batch 0, Channel 2
- 5.0f, 6.0f,
+ // Batch 0, Channel 2
+ 5.0f, 6.0f,
- // Batch 1, Channel 0
- 19.0f, 20.0f,
+ // Batch 1, Channel 0
+ 19.0f, 20.0f,
- // Batch 1, Channel 1
- 21.0f, 22.0f,
+ // Batch 1, Channel 1
+ 21.0f, 22.0f,
- // Batch 1, Channel 2
- 23.0f, 24.0f
- }));
+ // Batch 1, Channel 2
+ 23.0f, 24.0f
+ },
+ qScale, qOffset));
- armnn::TensorInfo input1TensorInfo({ 2, 4, 2 }, ArmnnType, qScale, qOffset);
- auto input1 = MakeTensor<T, 3>(input1TensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 7.0f, 8.0f,
+ TensorInfo input1TensorInfo({ 2, 4, 2 }, ArmnnType, qScale, qOffset);
+ auto input1 = MakeTensor<T, 3>(input1TensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 7.0f, 8.0f,
- // Batch 0, Channel 1
- 9.0f, 10.0f,
+ // Batch 0, Channel 1
+ 9.0f, 10.0f,
- // Batch 0, Channel 2
- 11.0f, 12.0f,
+ // Batch 0, Channel 2
+ 11.0f, 12.0f,
- // Batch 0, Channel 3
- 25.0f, 26.0f,
+ // Batch 0, Channel 3
+ 25.0f, 26.0f,
- // Batch 1, Channel 0
- 27.0f, 28.0f,
+ // Batch 1, Channel 0
+ 27.0f, 28.0f,
- // Batch 1, Channel 1
- 29.0f, 30.0f,
+ // Batch 1, Channel 1
+ 29.0f, 30.0f,
- // Batch 1, Channel 2
- 13.0f, 14.0f,
+ // Batch 1, Channel 2
+ 13.0f, 14.0f,
- // Batch 1, Channel 3
- 15.0f, 16.0f,
- }));
+ // Batch 1, Channel 3
+ 15.0f, 16.0f,
+ },
+ qScale, qOffset));
- armnn::TensorInfo input2TensorInfo({ 2, 1, 2 }, ArmnnType, qScale, qOffset);
- auto input2 = MakeTensor<T, 3>(input2TensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 17.0f, 18.0f,
+ TensorInfo input2TensorInfo({ 2, 1, 2 }, ArmnnType, qScale, qOffset);
+ auto input2 = MakeTensor<T, 3>(input2TensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 17.0f, 18.0f,
- // Batch 1, Channel 0
- 31.0f, 32.0f,
- }));
+ // Batch 1, Channel 0
+ 31.0f, 32.0f,
+ },
+ qScale, qOffset));
- armnn::TensorInfo outputTensorInfo({ 2, 8, 2 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 2, 8, 2 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 3> result(outputTensorInfo);
std::vector<T> output;
true);
result.output = MakeTensor<T, 3>(outputTensorInfo, output);
- result.outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 1.0f, 2.0f,
+ result.outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 1.0f, 2.0f,
- // Batch 0, Channel 1
- 3.0f, 4.0f,
+ // Batch 0, Channel 1
+ 3.0f, 4.0f,
- // Batch 0, Channel 2
- 5.0f, 6.0f,
+ // Batch 0, Channel 2
+ 5.0f, 6.0f,
- // Batch 0, Channel 3
- 7.0f, 8.0f,
+ // Batch 0, Channel 3
+ 7.0f, 8.0f,
- // Batch 0, Channel 4
- 9.0f, 10.0f,
+ // Batch 0, Channel 4
+ 9.0f, 10.0f,
- // Batch 0, Channel 5
- 11.0f, 12.0f,
+ // Batch 0, Channel 5
+ 11.0f, 12.0f,
- // Batch 0, Channel 6
- 25.0f, 26.0f,
+ // Batch 0, Channel 6
+ 25.0f, 26.0f,
- // Batch 0, Channel 7
- 17.0f, 18.0f,
+ // Batch 0, Channel 7
+ 17.0f, 18.0f,
- // Batch 1, Channel 0
- 19.0f, 20.0f,
+ // Batch 1, Channel 0
+ 19.0f, 20.0f,
- // Batch 1, Channel 1
- 21.0f, 22.0f,
+ // Batch 1, Channel 1
+ 21.0f, 22.0f,
- // Batch 1, Channel 2
- 23.0f, 24.0f,
+ // Batch 1, Channel 2
+ 23.0f, 24.0f,
- // Batch 1, Channel 3
- 27.0f, 28.0f,
+ // Batch 1, Channel 3
+ 27.0f, 28.0f,
- // Batch 1, Channel 4
- 29.0f, 30.0f,
+ // Batch 1, Channel 4
+ 29.0f, 30.0f,
- // Batch 1, Channel 5
- 13.0f, 14.0f,
+ // Batch 1, Channel 5
+ 13.0f, 14.0f,
- // Batch 1, Channel 6
- 15.0f, 16.0f,
+ // Batch 1, Channel 6
+ 15.0f, 16.0f,
- // Batch 1, Channel 7
- 31.0f, 32.0f,
- }));
+ // Batch 1, Channel 7
+ 31.0f, 32.0f,
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 3> Concat3dDim2DiffInputDimsTestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
bool useSubtensor,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo input0TensorInfo({ 2, 3, 2 }, ArmnnType, qScale, qOffset);
- auto input0 = MakeTensor<T, 3>(input0TensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 1.0f, 2.0f,
+ TensorInfo input0TensorInfo({ 2, 3, 2 }, ArmnnType, qScale, qOffset);
+ auto input0 = MakeTensor<T, 3>(input0TensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 1.0f, 2.0f,
- // Batch 0, Channel 1
- 3.0f, 4.0f,
+ // Batch 0, Channel 1
+ 3.0f, 4.0f,
- // Batch 0, Channel 2
- 5.0f, 6.0f,
+ // Batch 0, Channel 2
+ 5.0f, 6.0f,
- // Batch 1, Channel 0
- 19.0f, 20.0f,
+ // Batch 1, Channel 0
+ 19.0f, 20.0f,
- // Batch 1, Channel 1
- 21.0f, 22.0f,
+ // Batch 1, Channel 1
+ 21.0f, 22.0f,
- // Batch 1, Channel 2
- 23.0f, 24.0f
- }));
+ // Batch 1, Channel 2
+ 23.0f, 24.0f
+ },
+ qScale, qOffset));
- armnn::TensorInfo input1TensorInfo({ 2, 3, 1 }, ArmnnType, qScale, qOffset);
- auto input1 = MakeTensor<T, 3>(input1TensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 7.0f,
+ TensorInfo input1TensorInfo({ 2, 3, 1 }, ArmnnType, qScale, qOffset);
+ auto input1 = MakeTensor<T, 3>(input1TensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 7.0f,
- // Batch 0, Channel 1
- 9.0f,
+ // Batch 0, Channel 1
+ 9.0f,
- // Batch 0, Channel 2
- 11.0f,
+ // Batch 0, Channel 2
+ 11.0f,
- // Batch 1, Channel 0
- 25.0f,
+ // Batch 1, Channel 0
+ 25.0f,
- // Batch 1, Channel 1
- 27.0f,
+ // Batch 1, Channel 1
+ 27.0f,
- // Batch 1, Channel 2
- 29.0f
- }));
+ // Batch 1, Channel 2
+ 29.0f
+ },
+ qScale, qOffset));
- armnn::TensorInfo input2TensorInfo({ 2, 3, 3 }, ArmnnType, qScale, qOffset);
- auto input2 = MakeTensor<T, 3>(input2TensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 13.0f, 14.0f, 50.0f,
+ TensorInfo input2TensorInfo({ 2, 3, 3 }, ArmnnType, qScale, qOffset);
+ auto input2 = MakeTensor<T, 3>(input2TensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 13.0f, 14.0f, 50.0f,
- // Batch 0, Channel 1
- 15.0f, 16.0f, 51.0f,
+ // Batch 0, Channel 1
+ 15.0f, 16.0f, 51.0f,
- // Batch 0, Channel 2
- 17.0f, 18.0f, 52.0f,
+ // Batch 0, Channel 2
+ 17.0f, 18.0f, 52.0f,
- // Batch 1, Channel 0
- 31.0f, 32.0f, 53.0f,
+ // Batch 1, Channel 0
+ 31.0f, 32.0f, 53.0f,
- // Batch 1, Channel 1
- 33.0f, 34.0f, 54.0f,
+ // Batch 1, Channel 1
+ 33.0f, 34.0f, 54.0f,
- // Batch 1, Channel 2
- 35.0f, 36.0f, 55.0f,
- }));
+ // Batch 1, Channel 2
+ 35.0f, 36.0f, 55.0f,
+ },
+ qScale, qOffset));
- armnn::TensorInfo outputTensorInfo({ 2, 3, 6 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 2, 3, 6 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 3> result(outputTensorInfo);
std::vector<T> output;
useSubtensor);
result.output = MakeTensor<T, 3>(outputTensorInfo, output);
- result.outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 1.0f, 2.0f, 7.0f, 13.0f, 14.0f, 50.0f,
+ result.outputExpected = MakeTensor<T, 3>(outputTensorInfo, QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 1.0f, 2.0f, 7.0f, 13.0f, 14.0f, 50.0f,
- // Batch 0, Channel 1
- 3.0f, 4.0f, 9.0f, 15.0f, 16.0f, 51.0f,
+ // Batch 0, Channel 1
+ 3.0f, 4.0f, 9.0f, 15.0f, 16.0f, 51.0f,
- // Batch 0, Channel 2
- 5.0f, 6.0f, 11.0f, 17.0f, 18.0f, 52.0f,
+ // Batch 0, Channel 2
+ 5.0f, 6.0f, 11.0f, 17.0f, 18.0f, 52.0f,
- // Batch 1, Channel 0
- 19.0f, 20.0f, 25.0f, 31.0f, 32.0f, 53.0f,
+ // Batch 1, Channel 0
+ 19.0f, 20.0f, 25.0f, 31.0f, 32.0f, 53.0f,
- // Batch 1, Channel 1
- 21.0f, 22.0f, 27.0f, 33.0f, 34.0f, 54.0f,
+ // Batch 1, Channel 1
+ 21.0f, 22.0f, 27.0f, 33.0f, 34.0f, 54.0f,
- // Batch 1, Channel 2
- 23.0f, 24.0f, 29.0f, 35.0f, 36.0f, 55.0f,
- }));
+ // Batch 1, Channel 2
+ 23.0f, 24.0f, 29.0f, 35.0f, 36.0f, 55.0f,
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 4> Concat4dTestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
- const armnn::TensorInfo& outputTensorInfo,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ const TensorInfo& outputTensorInfo,
unsigned int dimension,
bool useSubtensor,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo inputTensorInfo({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
+ TensorInfo inputTensorInfo({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
- auto input0 = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- 1.0f, 2.0f,
- 3.0f, 4.0f,
- 5.0f, 6.0f,
- 7.0f, 8.0f,
- 9.0f, 10.0f,
- 11.0f, 12.0f
- }));
-
- auto input1 = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- 11.0f, 12.0f,
- 13.0f, 14.0f,
- 15.0f, 16.0f,
- 17.0f, 18.0f,
- 19.0f, 20.0f,
- 21.0f, 22.0f
- }));
+ auto input0 = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(
+ {
+ 1.0f, 2.0f,
+ 3.0f, 4.0f,
+ 5.0f, 6.0f,
+ 7.0f, 8.0f,
+ 9.0f, 10.0f,
+ 11.0f, 12.0f
+ },
+ qScale, qOffset));
+
+ auto input1 = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(
+ {
+ 11.0f, 12.0f,
+ 13.0f, 14.0f,
+ 15.0f, 16.0f,
+ 17.0f, 18.0f,
+ 19.0f, 20.0f,
+ 21.0f, 22.0f
+ },
+ qScale, qOffset));
- auto input2 = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- 21.0f, 22.0f,
- 23.0f, 24.0f,
- 25.0f, 26.0f,
- 27.0f, 28.0f,
- 29.0f, 30.0f,
- 31.0f, 32.0f
- }));
+ auto input2 = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(
+ {
+ 21.0f, 22.0f,
+ 23.0f, 24.0f,
+ 25.0f, 26.0f,
+ 27.0f, 28.0f,
+ 29.0f, 30.0f,
+ 31.0f, 32.0f
+ },
+ qScale, qOffset));
LayerTestResult<T, 4> result(outputTensorInfo);
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 4> Concat4dDim0TestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo outputTensorInfo({ 3, 3, 2, 2 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 3, 3, 2, 2 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 4> result = Concat4dTestImpl<ArmnnType>(
workloadFactory, memoryManager, outputTensorInfo, 0, true, qScale, qOffset);
- result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- 1.0f, 2.0f,
- 3.0f, 4.0f,
- 5.0f, 6.0f,
- 7.0f, 8.0f,
- 9.0f, 10.0f,
- 11.0f, 12.0f,
-
- 11.0f, 12.0f,
- 13.0f, 14.0f,
- 15.0f, 16.0f,
- 17.0f, 18.0f,
- 19.0f, 20.0f,
- 21.0f, 22.0f,
-
- 21.0f, 22.0f,
- 23.0f, 24.0f,
- 25.0f, 26.0f,
- 27.0f, 28.0f,
- 29.0f, 30.0f,
- 31.0f, 32.0f
- }));
+ result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
+ {
+ 1.0f, 2.0f,
+ 3.0f, 4.0f,
+ 5.0f, 6.0f,
+ 7.0f, 8.0f,
+ 9.0f, 10.0f,
+ 11.0f, 12.0f,
+
+ 11.0f, 12.0f,
+ 13.0f, 14.0f,
+ 15.0f, 16.0f,
+ 17.0f, 18.0f,
+ 19.0f, 20.0f,
+ 21.0f, 22.0f,
+
+ 21.0f, 22.0f,
+ 23.0f, 24.0f,
+ 25.0f, 26.0f,
+ 27.0f, 28.0f,
+ 29.0f, 30.0f,
+ 31.0f, 32.0f
+ },
+ qScale, qOffset));
+
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 4> Concat4dDim1TestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo outputTensorInfo({ 1, 9, 2, 2 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 1, 9, 2, 2 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 4> result = Concat4dTestImpl<ArmnnType>(
workloadFactory, memoryManager, outputTensorInfo, 1, true, qScale, qOffset);
- result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- 1.0f, 2.0f,
- 3.0f, 4.0f,
- 5.0f, 6.0f,
- 7.0f, 8.0f,
- 9.0f, 10.0f,
- 11.0f, 12.0f,
-
- 11.0f, 12.0f,
- 13.0f, 14.0f,
- 15.0f, 16.0f,
- 17.0f, 18.0f,
- 19.0f, 20.0f,
- 21.0f, 22.0f,
-
- 21.0f, 22.0f,
- 23.0f, 24.0f,
- 25.0f, 26.0f,
- 27.0f, 28.0f,
- 29.0f, 30.0f,
- 31.0f, 32.0f
- }));
+ result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
+ {
+ 1.0f, 2.0f,
+ 3.0f, 4.0f,
+ 5.0f, 6.0f,
+ 7.0f, 8.0f,
+ 9.0f, 10.0f,
+ 11.0f, 12.0f,
+
+ 11.0f, 12.0f,
+ 13.0f, 14.0f,
+ 15.0f, 16.0f,
+ 17.0f, 18.0f,
+ 19.0f, 20.0f,
+ 21.0f, 22.0f,
+
+ 21.0f, 22.0f,
+ 23.0f, 24.0f,
+ 25.0f, 26.0f,
+ 27.0f, 28.0f,
+ 29.0f, 30.0f,
+ 31.0f, 32.0f
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 4> Concat4dDim2TestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset)
{
- armnn::TensorInfo outputTensorInfo({ 1, 3, 6, 2 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 1, 3, 6, 2 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 4> result = Concat4dTestImpl<ArmnnType>(
workloadFactory, memoryManager, outputTensorInfo, 2, true, qScale, qOffset);
- result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- 1.0f, 2.0f,
- 3.0f, 4.0f,
- 11.0f, 12.0f,
- 13.0f, 14.0f,
- 21.0f, 22.0f,
- 23.0f, 24.0f,
-
- 5.0f, 6.0f,
- 7.0f, 8.0f,
- 15.0f, 16.0f,
- 17.0f, 18.0f,
- 25.0f, 26.0f,
- 27.0f, 28.0f,
-
- 9.0f, 10.0f,
- 11.0f, 12.0f,
- 19.0f, 20.0f,
- 21.0f, 22.0f,
- 29.0f, 30.0f,
- 31.0f, 32.0f
- }));
+ result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
+ {
+ 1.0f, 2.0f,
+ 3.0f, 4.0f,
+ 11.0f, 12.0f,
+ 13.0f, 14.0f,
+ 21.0f, 22.0f,
+ 23.0f, 24.0f,
+
+ 5.0f, 6.0f,
+ 7.0f, 8.0f,
+ 15.0f, 16.0f,
+ 17.0f, 18.0f,
+ 25.0f, 26.0f,
+ 27.0f, 28.0f,
+
+ 9.0f, 10.0f,
+ 11.0f, 12.0f,
+ 19.0f, 20.0f,
+ 21.0f, 22.0f,
+ 29.0f, 30.0f,
+ 31.0f, 32.0f
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 4> Concat4dDim3TestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset,
bool useSubtensor)
{
- armnn::TensorInfo outputTensorInfo({ 1, 3, 2, 6 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 1, 3, 2, 6 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 4> result = Concat4dTestImpl<ArmnnType>(
workloadFactory, memoryManager, outputTensorInfo, 3, useSubtensor, qScale, qOffset);
- result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- 1.0f, 2.0f,
- 11.0f, 12.0f,
- 21.0f, 22.0f,
- 3.0f, 4.0f,
- 13.0f, 14.0f,
- 23.0f, 24.0f,
-
- 5.0f, 6.0f,
- 15.0f, 16.0f,
- 25.0f, 26.0f,
- 7.0f, 8.0f,
- 17.0f, 18.0f,
- 27.0f, 28.0f,
-
- 9.0f, 10.0f,
- 19.0f, 20.0f,
- 29.0f, 30.0f,
- 11.0f, 12.0f,
- 21.0f, 22.0f,
- 31.0f, 32.0f
- }));
+ result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
+ {
+ 1.0f, 2.0f,
+ 11.0f, 12.0f,
+ 21.0f, 22.0f,
+ 3.0f, 4.0f,
+ 13.0f, 14.0f,
+ 23.0f, 24.0f,
+
+ 5.0f, 6.0f,
+ 15.0f, 16.0f,
+ 25.0f, 26.0f,
+ 7.0f, 8.0f,
+ 17.0f, 18.0f,
+ 27.0f, 28.0f,
+
+ 9.0f, 10.0f,
+ 19.0f, 20.0f,
+ 29.0f, 30.0f,
+ 11.0f, 12.0f,
+ 21.0f, 22.0f,
+ 31.0f, 32.0f
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 4> Concat4dDiffShapeDim0TestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset)
{
- unsigned int dimension = 0;
- armnn::TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
+ constexpr unsigned int dimension = 0u;
- auto input0 = MakeTensor<T, 4>(inputTensorInfo0, QuantizedVector<T>(qScale, qOffset, {
- 1.0f, 2.0f,
- 3.0f, 4.0f,
- 5.0f, 6.0f,
- 7.0f, 8.0f,
- 9.0f, 10.0f,
- 11.0f, 12.0f
- }));
-
- armnn::TensorInfo inputTensorInfo1({ 2, 3, 2, 2 }, ArmnnType, qScale, qOffset);
-
- auto input1 = MakeTensor<T, 4>(inputTensorInfo1, QuantizedVector<T>(qScale, qOffset, {
- 11.0f, 12.0f,
- 13.0f, 14.0f,
- 15.0f, 16.0f,
- 17.0f, 18.0f,
- 19.0f, 20.0f,
- 21.0f, 22.0f,
-
- 21.0f, 22.0f,
- 23.0f, 24.0f,
- 25.0f, 26.0f,
- 27.0f, 28.0f,
- 29.0f, 30.0f,
- 31.0f, 32.0f
+ TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
+ auto input0 = MakeTensor<T, 4>(inputTensorInfo0, QuantizedVector<T>(
+ {
+ 1.0f, 2.0f,
+ 3.0f, 4.0f,
+ 5.0f, 6.0f,
+ 7.0f, 8.0f,
+ 9.0f, 10.0f,
+ 11.0f, 12.0f
+ },
+ qScale, qOffset));
+
+ TensorInfo inputTensorInfo1({ 2, 3, 2, 2 }, ArmnnType, qScale, qOffset);
+
+ auto input1 = MakeTensor<T, 4>(inputTensorInfo1, QuantizedVector<T>(
+ {
+ 11.0f, 12.0f,
+ 13.0f, 14.0f,
+ 15.0f, 16.0f,
+ 17.0f, 18.0f,
+ 19.0f, 20.0f,
+ 21.0f, 22.0f,
- }));
+ 21.0f, 22.0f,
+ 23.0f, 24.0f,
+ 25.0f, 26.0f,
+ 27.0f, 28.0f,
+ 29.0f, 30.0f,
+ 31.0f, 32.0f
+ },
+ qScale, qOffset));
- armnn::TensorInfo outputTensorInfo({ 3, 3, 2, 2 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 3, 3, 2, 2 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 4> result(outputTensorInfo);
true);
result.output = MakeTensor<T, 4>(outputTensorInfo, output);
- result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- 1.0f, 2.0f,
- 3.0f, 4.0f,
- 5.0f, 6.0f,
- 7.0f, 8.0f,
- 9.0f, 10.0f,
- 11.0f, 12.0f,
-
- 11.0f, 12.0f,
- 13.0f, 14.0f,
- 15.0f, 16.0f,
- 17.0f, 18.0f,
- 19.0f, 20.0f,
- 21.0f, 22.0f,
-
- 21.0f, 22.0f,
- 23.0f, 24.0f,
- 25.0f, 26.0f,
- 27.0f, 28.0f,
- 29.0f, 30.0f,
- 31.0f, 32.0f
- }));
+ result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
+ {
+ 1.0f, 2.0f,
+ 3.0f, 4.0f,
+ 5.0f, 6.0f,
+ 7.0f, 8.0f,
+ 9.0f, 10.0f,
+ 11.0f, 12.0f,
+
+ 11.0f, 12.0f,
+ 13.0f, 14.0f,
+ 15.0f, 16.0f,
+ 17.0f, 18.0f,
+ 19.0f, 20.0f,
+ 21.0f, 22.0f,
+
+ 21.0f, 22.0f,
+ 23.0f, 24.0f,
+ 25.0f, 26.0f,
+ 27.0f, 28.0f,
+ 29.0f, 30.0f,
+ 31.0f, 32.0f
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 4> Concat4dDiffShapeDim1TestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset)
{
- unsigned int dimension = 1;
- armnn::TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
-
- auto input0 = MakeTensor<T, 4>(inputTensorInfo0, QuantizedVector<T>(qScale, qOffset, {
- 1.0f, 2.0f,
- 3.0f, 4.0f,
- 5.0f, 6.0f,
- 7.0f, 8.0f,
- 9.0f, 10.0f,
- 11.0f, 12.0f
- }));
-
- armnn::TensorInfo inputTensorInfo1({ 1, 2, 2, 2 }, ArmnnType, qScale, qOffset);
+ constexpr unsigned int dimension = 1u;
- auto input1 = MakeTensor<T, 4>(inputTensorInfo1, QuantizedVector<T>(qScale, qOffset, {
- 11.0f, 12.0f,
- 13.0f, 14.0f,
- 15.0f, 16.0f,
- 17.0f, 18.0f,
-
- }));
+ TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
+ auto input0 = MakeTensor<T, 4>(inputTensorInfo0, QuantizedVector<T>(
+ {
+ 1.0f, 2.0f,
+ 3.0f, 4.0f,
+ 5.0f, 6.0f,
+ 7.0f, 8.0f,
+ 9.0f, 10.0f,
+ 11.0f, 12.0f
+ },
+ qScale, qOffset));
+
+ TensorInfo inputTensorInfo1({ 1, 2, 2, 2 }, ArmnnType, qScale, qOffset);
+
+ auto input1 = MakeTensor<T, 4>(inputTensorInfo1, QuantizedVector<T>(
+ {
+ 11.0f, 12.0f,
+ 13.0f, 14.0f,
+ 15.0f, 16.0f,
+ 17.0f, 18.0f,
+ },
+ qScale, qOffset));
- armnn::TensorInfo outputTensorInfo({ 1, 5, 2, 2 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 1, 5, 2, 2 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 4> result(outputTensorInfo);
true);
result.output = MakeTensor<T, 4>(outputTensorInfo, output);
- result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- 1.0f, 2.0f,
- 3.0f, 4.0f,
- 5.0f, 6.0f,
- 7.0f, 8.0f,
- 9.0f, 10.0f,
- 11.0f, 12.0f,
- 11.0f, 12.0f,
- 13.0f, 14.0f,
- 15.0f, 16.0f,
- 17.0f, 18.0f
- }));
+ result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
+ {
+ 1.0f, 2.0f,
+ 3.0f, 4.0f,
+ 5.0f, 6.0f,
+ 7.0f, 8.0f,
+ 9.0f, 10.0f,
+ 11.0f, 12.0f,
+ 11.0f, 12.0f,
+ 13.0f, 14.0f,
+ 15.0f, 16.0f,
+ 17.0f, 18.0f
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 4> Concat4dDiffShapeDim2TestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset)
{
- unsigned int dimension = 2;
- armnn::TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
+ constexpr unsigned int dimension = 2u;
- auto input0 = MakeTensor<T, 4>(inputTensorInfo0, QuantizedVector<T>(qScale, qOffset, {
- 1.0f, 2.0f,
- 3.0f, 4.0f,
- 5.0f, 6.0f,
- 7.0f, 8.0f,
- 9.0f, 10.0f,
- 11.0f, 12.0f
- }));
-
- armnn::TensorInfo inputTensorInfo1({ 1, 3, 3, 2 }, ArmnnType, qScale, qOffset);
-
- auto input1 = MakeTensor<T, 4>(inputTensorInfo1, QuantizedVector<T>(qScale, qOffset, {
- 11.0f, 12.0f,
- 13.0f, 14.0f,
- 15.0f, 16.0f,
- 17.0f, 18.0f,
- 19.0f, 20.0f,
- 21.0f, 22.0f,
- 23.0f, 24.0f,
- 25.0f, 26.0f,
- 27.0f, 28.0f
- }));
+ TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
+ auto input0 = MakeTensor<T, 4>(inputTensorInfo0, QuantizedVector<T>(
+ {
+ 1.0f, 2.0f,
+ 3.0f, 4.0f,
+ 5.0f, 6.0f,
+ 7.0f, 8.0f,
+ 9.0f, 10.0f,
+ 11.0f, 12.0f
+ },
+ qScale, qOffset));
- armnn::TensorInfo outputTensorInfo({ 1, 3, 5, 2 }, ArmnnType, qScale, qOffset);
+ TensorInfo inputTensorInfo1({ 1, 3, 3, 2 }, ArmnnType, qScale, qOffset);
+ auto input1 = MakeTensor<T, 4>(inputTensorInfo1, QuantizedVector<T>(
+ {
+ 11.0f, 12.0f,
+ 13.0f, 14.0f,
+ 15.0f, 16.0f,
+ 17.0f, 18.0f,
+ 19.0f, 20.0f,
+ 21.0f, 22.0f,
+ 23.0f, 24.0f,
+ 25.0f, 26.0f,
+ 27.0f, 28.0f
+ },
+ qScale, qOffset));
+ TensorInfo outputTensorInfo({ 1, 3, 5, 2 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 4> result(outputTensorInfo);
std::vector<T> output;
dimension,
true);
- result.output = MakeTensor<T, 4>(outputTensorInfo, output);
- result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- 1.0f, 2.0f,
- 3.0f, 4.0f,
- 11.0f, 12.0f,
- 13.0f, 14.0f,
- 15.0f, 16.0f,
-
- 5.0f, 6.0f,
- 7.0f, 8.0f,
- 17.0f, 18.0f,
- 19.0f, 20.0f,
- 21.0f, 22.0f,
-
- 9.0f, 10.0f,
- 11.0f, 12.0f,
- 23.0f, 24.0f,
- 25.0f, 26.0f,
- 27.0f, 28.0f
- }));
+ result.output = MakeTensor<T, 4>(outputTensorInfo, output);
+ result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
+ {
+ 1.0f, 2.0f,
+ 3.0f, 4.0f,
+ 11.0f, 12.0f,
+ 13.0f, 14.0f,
+ 15.0f, 16.0f,
+
+ 5.0f, 6.0f,
+ 7.0f, 8.0f,
+ 17.0f, 18.0f,
+ 19.0f, 20.0f,
+ 21.0f, 22.0f,
+
+ 9.0f, 10.0f,
+ 11.0f, 12.0f,
+ 23.0f, 24.0f,
+ 25.0f, 26.0f,
+ 27.0f, 28.0f
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
+template<DataType ArmnnType, typename T = ResolveType<ArmnnType>>
LayerTestResult<T, 4> Concat4dDiffShapeDim3TestImpl(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
float qScale,
int32_t qOffset,
bool useSubtensor)
{
- unsigned int dimension = 3;
- armnn::TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
-
- auto input0 = MakeTensor<T, 4>(inputTensorInfo0, QuantizedVector<T>(qScale, qOffset, {
- 1.0f, 2.0f,
- 3.0f, 4.0f,
- 5.0f, 6.0f,
- 7.0f, 8.0f,
- 9.0f, 10.0f,
- 11.0f, 12.0f
- }));
+ constexpr unsigned int dimension = 3u;
- armnn::TensorInfo inputTensorInfo1({ 1, 3, 2, 3 }, ArmnnType, qScale, qOffset);
-
- auto input1 = MakeTensor<T, 4>(inputTensorInfo1, QuantizedVector<T>(qScale, qOffset, {
- 11.0f, 12.0f, 13.0f,
- 14.0f, 15.0f, 16.0f,
+ TensorInfo inputTensorInfo0({ 1, 3, 2, 2 }, ArmnnType, qScale, qOffset);
+ auto input0 = MakeTensor<T, 4>(inputTensorInfo0, QuantizedVector<T>(
+ {
+ 1.0f, 2.0f,
+ 3.0f, 4.0f,
+ 5.0f, 6.0f,
+ 7.0f, 8.0f,
+ 9.0f, 10.0f,
+ 11.0f, 12.0f
+ },
+ qScale, qOffset));
+
+ TensorInfo inputTensorInfo1({ 1, 3, 2, 3 }, ArmnnType, qScale, qOffset);
+ auto input1 = MakeTensor<T, 4>(inputTensorInfo1, QuantizedVector<T>(
+ {
+ 11.0f, 12.0f, 13.0f,
+ 14.0f, 15.0f, 16.0f,
- 17.0f, 18.0f, 19.0f,
- 20.0f, 21.0f, 22.0f,
+ 17.0f, 18.0f, 19.0f,
+ 20.0f, 21.0f, 22.0f,
- 23.0f, 24.0f, 25.0f,
- 26.0f, 27.0f, 28.0f
- }));
+ 23.0f, 24.0f, 25.0f,
+ 26.0f, 27.0f, 28.0f
+ },
+ qScale, qOffset));
- armnn::TensorInfo outputTensorInfo({ 1, 3, 2, 5 }, ArmnnType, qScale, qOffset);
+ TensorInfo outputTensorInfo({ 1, 3, 2, 5 }, ArmnnType, qScale, qOffset);
LayerTestResult<T, 4> result(outputTensorInfo);
useSubtensor);
result.output = MakeTensor<T, 4>(outputTensorInfo, output);
- result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, {
- 1.0f, 2.0f, 11.0f, 12.0f, 13.0f,
- 3.0f, 4.0f, 14.0f, 15.0f, 16.0f,
- 5.0f, 6.0f, 17.0f, 18.0f, 19.0f,
- 7.0f, 8.0f, 20.0f, 21.0f, 22.0f,
- 9.0f, 10.0f, 23.0f, 24.0f, 25.0f,
- 11.0f, 12.0f, 26.0f, 27.0f, 28.0f
- }));
+ result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
+ {
+ 1.0f, 2.0f, 11.0f, 12.0f, 13.0f,
+ 3.0f, 4.0f, 14.0f, 15.0f, 16.0f,
+ 5.0f, 6.0f, 17.0f, 18.0f, 19.0f,
+ 7.0f, 8.0f, 20.0f, 21.0f, 22.0f,
+ 9.0f, 10.0f, 23.0f, 24.0f, 25.0f,
+ 11.0f, 12.0f, 26.0f, 27.0f, 28.0f
+ },
+ qScale, qOffset));
return result;
}
-template<armnn::DataType ArmnnType, typename T>
+template<DataType ArmnnType, typename T>
LayerTestResult<T, 3> ConcatDifferentInputOutputQParamTest(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
bool useSubtensor)
{
// Defines the tensor descriptors.
- armnn::TensorInfo outputTensorInfo({ 3, 6, 3 }, ArmnnType);
- armnn::TensorInfo inputTensorInfo1({ 3, 6, 2 }, ArmnnType);
- armnn::TensorInfo inputTensorInfo2({ 3, 6, 1 }, ArmnnType);
+ TensorInfo outputTensorInfo({ 3, 6, 3 }, ArmnnType);
+ TensorInfo inputTensorInfo1({ 3, 6, 2 }, ArmnnType);
+ TensorInfo inputTensorInfo2({ 3, 6, 1 }, ArmnnType);
- std::vector<armnn::TensorShape> inputTensorShapes({inputTensorInfo1.GetShape(), inputTensorInfo2.GetShape()});
+ std::vector<TensorShape> inputTensorShapes({inputTensorInfo1.GetShape(), inputTensorInfo2.GetShape()});
// Quantized input1 tensor.
const float inputScale1 = 0.5f;
inputTensorInfo2.SetQuantizationOffset(inputOffset2);
std::vector<unsigned int> wOrigin1 = { 0, 0, 0 }; //Extent of the window is defined by size of input[0].
- armnn::ConcatQueueDescriptor::ViewOrigin window1(wOrigin1);
+ ConcatQueueDescriptor::ViewOrigin window1(wOrigin1);
std::vector<unsigned int> wOrigin2 = { 0, 0, 2 }; //Extent of the window is defined by size of input[1].
- armnn::ConcatQueueDescriptor::ViewOrigin window2(wOrigin2);
+ ConcatQueueDescriptor::ViewOrigin window2(wOrigin2);
- std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
+ std::unique_ptr<ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
bool subTensorsSupported = useSubtensor && workloadFactory.SupportsSubTensors();
- std::unique_ptr<armnn::ITensorHandle> inputHandle1 =
+ std::unique_ptr<ITensorHandle> inputHandle1 =
subTensorsSupported ?
workloadFactory.CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) :
workloadFactory.CreateTensorHandle(inputTensorInfo1);
- std::unique_ptr<armnn::ITensorHandle> inputHandle2 =
+ std::unique_ptr<ITensorHandle> inputHandle2 =
subTensorsSupported ?
workloadFactory.CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) :
workloadFactory.CreateTensorHandle(inputTensorInfo2);
- armnn::ConcatQueueDescriptor data;
- armnn::OriginsDescriptor desc = armnn::CreateDescriptorForConcatenation(
+ ConcatQueueDescriptor data;
+ OriginsDescriptor desc = CreateDescriptorForConcatenation(
inputTensorShapes.begin(),inputTensorShapes.end(), 2);
data.m_Parameters = desc;
- armnn::WorkloadInfo info;
+ WorkloadInfo info;
AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get());
AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
data.m_ViewOrigins.push_back(window1);
data.m_ViewOrigins.push_back(window2);
- std::unique_ptr<armnn::IWorkload> workload = workloadFactory.CreateConcat(data, info);
+ std::unique_ptr<IWorkload> workload = workloadFactory.CreateConcat(data, info);
inputHandle1->Allocate();
inputHandle2->Allocate();
// Explicit template specializations
//
-template LayerTestResult<armnn::ResolveType<armnn::DataType::QuantisedAsymm8>, 3>
-ConcatDifferentInputOutputQParamTest<armnn::DataType::QuantisedAsymm8>(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+template LayerTestResult<ResolveType<DataType::QuantisedAsymm8>, 3>
+ConcatDifferentInputOutputQParamTest<DataType::QuantisedAsymm8>(
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
bool useSubtensor);
-template LayerTestResult<armnn::ResolveType<armnn::DataType::QuantisedSymm16>, 3>
-ConcatDifferentInputOutputQParamTest<armnn::DataType::QuantisedSymm16>(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+template LayerTestResult<ResolveType<DataType::QuantisedSymm16>, 3>
+ConcatDifferentInputOutputQParamTest<DataType::QuantisedSymm16>(
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
bool useSubtensor);
//
//
LayerTestResult<float,3> ConcatTest(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
unsigned int outputWidth = 3;
unsigned int outputHeight = 6;
unsigned int inputChannels2 = 1;
// Define the tensor descriptors.
- armnn::TensorInfo outputTensorInfo({ outputChannels, outputHeight, outputWidth }, armnn::DataType::Float32);
- armnn::TensorInfo inputTensorInfo1({ inputChannels1, inputHeight1, inputWidth1 }, armnn::DataType::Float32);
- armnn::TensorInfo inputTensorInfo2({ inputChannels2, inputHeight2, inputWidth2 }, armnn::DataType::Float32);
+ TensorInfo outputTensorInfo({ outputChannels, outputHeight, outputWidth }, DataType::Float32);
+ TensorInfo inputTensorInfo1({ inputChannels1, inputHeight1, inputWidth1 }, DataType::Float32);
+ TensorInfo inputTensorInfo2({ inputChannels2, inputHeight2, inputWidth2 }, DataType::Float32);
LayerTestResult<float,3> ret(outputTensorInfo);
);
std::vector<unsigned int> wOrigin1 = {0, 0, 0}; //Extent of the window is defined by size of input[0].
- armnn::ConcatQueueDescriptor::ViewOrigin window1(wOrigin1);
+ ConcatQueueDescriptor::ViewOrigin window1(wOrigin1);
std::vector<unsigned int> wOrigin2 = {2, 0, 0}; //Extent of the window is defined by size of input[1].
- armnn::ConcatQueueDescriptor::ViewOrigin window2(wOrigin2);
+ ConcatQueueDescriptor::ViewOrigin window2(wOrigin2);
- std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
+ std::unique_ptr<ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
bool subTensorsSupported = workloadFactory.SupportsSubTensors();
- std::unique_ptr<armnn::ITensorHandle> inputHandle1 =
+ std::unique_ptr<ITensorHandle> inputHandle1 =
subTensorsSupported ?
workloadFactory.CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) :
workloadFactory.CreateTensorHandle(inputTensorInfo1);
- std::unique_ptr<armnn::ITensorHandle> inputHandle2 =
+ std::unique_ptr<ITensorHandle> inputHandle2 =
subTensorsSupported ?
workloadFactory.CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) :
workloadFactory.CreateTensorHandle(inputTensorInfo2);
- armnn::ConcatQueueDescriptor data;
- armnn::WorkloadInfo info;
+ ConcatQueueDescriptor data;
+ WorkloadInfo info;
AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get());
AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
data.m_ViewOrigins.push_back(window1);
data.m_ViewOrigins.push_back(window2);
- std::unique_ptr<armnn::IWorkload> workload = workloadFactory.CreateConcat(data, info);
+ std::unique_ptr<IWorkload> workload = workloadFactory.CreateConcat(data, info);
inputHandle1->Allocate();
inputHandle2->Allocate();
}
LayerTestResult<float, 1> Concat1dTest(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat1dTestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
+ return Concat1dTestImpl<DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<float, 2> Concat2dDim0Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat2dDim0TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
+ return Concat2dDim0TestImpl<DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<float, 2> Concat2dDim1Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat2dDim1TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
+ return Concat2dDim1TestImpl<DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<float, 2> Concat2dDim0DiffInputDimsTest(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat2dDim0DiffInputDimsTestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
+ return Concat2dDim0DiffInputDimsTestImpl<DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<float, 2> Concat2dDim1DiffInputDimsTest(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat2dDim1DiffInputDimsTestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
+ return Concat2dDim1DiffInputDimsTestImpl<DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<float, 3> Concat3dDim0Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat3dDim0TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
+ return Concat3dDim0TestImpl<DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<float, 3> Concat3dDim1Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat3dDim1TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
+ return Concat3dDim1TestImpl<DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<float, 3> Concat3dDim2Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
bool useSubtensor)
{
- return Concat3dDim2TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager, useSubtensor, 0.0f, 0);
+ return Concat3dDim2TestImpl<DataType::Float32>(workloadFactory, memoryManager, useSubtensor, 0.0f, 0);
}
LayerTestResult<float, 3> Concat3dDim0DiffInputDimsTest(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat3dDim0DiffInputDimsTestImpl<armnn::DataType::Float32>(
+ return Concat3dDim0DiffInputDimsTestImpl<DataType::Float32>(
workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<float, 3> Concat3dDim1DiffInputDimsTest(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat3dDim1DiffInputDimsTestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
+ return Concat3dDim1DiffInputDimsTestImpl<DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<float, 3> Concat3dDim2DiffInputDimsTest(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
bool useSubtensor)
{
- return Concat3dDim2DiffInputDimsTestImpl<armnn::DataType::Float32>(
+ return Concat3dDim2DiffInputDimsTestImpl<DataType::Float32>(
workloadFactory, memoryManager, useSubtensor, 0.0f, 0);
}
LayerTestResult<float, 4> Concat4dDim0Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat4dDim0TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
+ return Concat4dDim0TestImpl<DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<float, 4> Concat4dDim1Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat4dDim1TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
+ return Concat4dDim1TestImpl<DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<float, 4> Concat4dDim2Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat4dDim2TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
+ return Concat4dDim2TestImpl<DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<float, 4> Concat4dDim3Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
bool useSubtensor)
{
- return Concat4dDim3TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0, useSubtensor);
+ return Concat4dDim3TestImpl<DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0, useSubtensor);
}
LayerTestResult<float, 4> Concat4dDiffShapeDim0Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat4dDiffShapeDim0TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
+ return Concat4dDiffShapeDim0TestImpl<DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<float, 4> Concat4dDiffShapeDim1Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat4dDiffShapeDim1TestImpl<armnn::DataType::Float32>(
+ return Concat4dDiffShapeDim1TestImpl<DataType::Float32>(
workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<float, 4> Concat4dDiffShapeDim2Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat4dDiffShapeDim2TestImpl<armnn::DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
+ return Concat4dDiffShapeDim2TestImpl<DataType::Float32>(workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<float, 4> Concat4dDiffShapeDim3Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
bool useSubtensor)
{
- return Concat4dDiffShapeDim3TestImpl<armnn::DataType::Float32>(
+ return Concat4dDiffShapeDim3TestImpl<DataType::Float32>(
workloadFactory, memoryManager, 0.0f, 0, useSubtensor);
}
-LayerTestResult<armnn::Half, 3> ConcatFloat16Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+LayerTestResult<Half, 3> ConcatFloat16Test(
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat3dDim1TestImpl<armnn::DataType::Float16>(workloadFactory, memoryManager, 0.0f, 0);
+ return Concat3dDim1TestImpl<DataType::Float16>(workloadFactory, memoryManager, 0.0f, 0);
}
LayerTestResult<uint8_t, 3> ConcatUint8DifferentQParamsTest(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
unsigned int outputWidth = 3;
unsigned int outputHeight = 6;
unsigned int inputChannels2 = 1;
// Defines the tensor descriptors.
- armnn::TensorInfo outputTensorInfo({ outputChannels, outputHeight, outputWidth }, armnn::DataType::QuantisedAsymm8);
- armnn::TensorInfo inputTensorInfo1({ inputChannels1, inputHeight1, inputWidth1 }, armnn::DataType::QuantisedAsymm8);
- armnn::TensorInfo inputTensorInfo2({ inputChannels2, inputHeight2, inputWidth2 }, armnn::DataType::QuantisedAsymm8);
+ TensorInfo outputTensorInfo({ outputChannels, outputHeight, outputWidth }, DataType::QuantisedAsymm8);
+ TensorInfo inputTensorInfo1({ inputChannels1, inputHeight1, inputWidth1 }, DataType::QuantisedAsymm8);
+ TensorInfo inputTensorInfo2({ inputChannels2, inputHeight2, inputWidth2 }, DataType::QuantisedAsymm8);
// Quantized input1 tensor. Range [-3, 1]
const float inputScale1 = 0.015686f;
inputTensorInfo2.SetQuantizationOffset(inputOffset2);
std::vector<unsigned int> wOrigin1 = { 0, 0, 0 }; //Extent of the window is defined by size of input[0].
- armnn::ConcatQueueDescriptor::ViewOrigin window1(wOrigin1);
+ ConcatQueueDescriptor::ViewOrigin window1(wOrigin1);
std::vector<unsigned int> wOrigin2 = { 2, 0, 0 }; //Extent of the window is defined by size of input[1].
- armnn::ConcatQueueDescriptor::ViewOrigin window2(wOrigin2);
+ ConcatQueueDescriptor::ViewOrigin window2(wOrigin2);
- std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
+ std::unique_ptr<ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
bool subTensorsSupported = workloadFactory.SupportsSubTensors();
- std::unique_ptr<armnn::ITensorHandle> inputHandle1 =
+ std::unique_ptr<ITensorHandle> inputHandle1 =
subTensorsSupported ?
workloadFactory.CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) :
workloadFactory.CreateTensorHandle(inputTensorInfo1);
- std::unique_ptr<armnn::ITensorHandle> inputHandle2 =
+ std::unique_ptr<ITensorHandle> inputHandle2 =
subTensorsSupported ?
workloadFactory.CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) :
workloadFactory.CreateTensorHandle(inputTensorInfo2);
- armnn::ConcatQueueDescriptor data;
- armnn::WorkloadInfo info;
+ ConcatQueueDescriptor data;
+ WorkloadInfo info;
AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get());
AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
data.m_ViewOrigins.push_back(window1);
data.m_ViewOrigins.push_back(window2);
- std::unique_ptr<armnn::IWorkload> workload = workloadFactory.CreateConcat(data, info);
+ std::unique_ptr<IWorkload> workload = workloadFactory.CreateConcat(data, info);
inputHandle1->Allocate();
inputHandle2->Allocate();
}
LayerTestResult<uint8_t, 3> ConcatUint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
unsigned int outputWidth = 3;
unsigned int outputHeight = 6;
unsigned int inputChannels2 = 1;
// Defines the tensor descriptors.
- armnn::TensorInfo outputTensorInfo({ outputChannels, outputHeight, outputWidth }, armnn::DataType::QuantisedAsymm8);
- armnn::TensorInfo inputTensorInfo1({ inputChannels1, inputHeight1, inputWidth1 }, armnn::DataType::QuantisedAsymm8);
- armnn::TensorInfo inputTensorInfo2({ inputChannels2, inputHeight2, inputWidth2 }, armnn::DataType::QuantisedAsymm8);
+ TensorInfo outputTensorInfo({ outputChannels, outputHeight, outputWidth }, DataType::QuantisedAsymm8);
+ TensorInfo inputTensorInfo1({ inputChannels1, inputHeight1, inputWidth1 }, DataType::QuantisedAsymm8);
+ TensorInfo inputTensorInfo2({ inputChannels2, inputHeight2, inputWidth2 }, DataType::QuantisedAsymm8);
// Arbitrary scale and offsets. They don't really matter as the Concat operator doesn't dequantize/quantize them.
const float scale = 0.13497836f;
);
std::vector<unsigned int> wOrigin1 = { 0, 0, 0 }; //Extent of the window is defined by size of input[0].
- armnn::ConcatQueueDescriptor::ViewOrigin window1(wOrigin1);
+ ConcatQueueDescriptor::ViewOrigin window1(wOrigin1);
std::vector<unsigned int> wOrigin2 = { 2, 0, 0 }; //Extent of the window is defined by size of input[1].
- armnn::ConcatQueueDescriptor::ViewOrigin window2(wOrigin2);
+ ConcatQueueDescriptor::ViewOrigin window2(wOrigin2);
- std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
+ std::unique_ptr<ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
bool subTensorsSupported = workloadFactory.SupportsSubTensors();
- std::unique_ptr<armnn::ITensorHandle> inputHandle1 =
+ std::unique_ptr<ITensorHandle> inputHandle1 =
subTensorsSupported ?
workloadFactory.CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) :
workloadFactory.CreateTensorHandle(inputTensorInfo1);
- std::unique_ptr<armnn::ITensorHandle> inputHandle2 =
+ std::unique_ptr<ITensorHandle> inputHandle2 =
subTensorsSupported ?
workloadFactory.CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) :
workloadFactory.CreateTensorHandle(inputTensorInfo2);
- armnn::ConcatQueueDescriptor data;
- armnn::WorkloadInfo info;
+ ConcatQueueDescriptor data;
+ WorkloadInfo info;
AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get());
AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
data.m_ViewOrigins.push_back(window1);
data.m_ViewOrigins.push_back(window2);
- std::unique_ptr<armnn::IWorkload> workload = workloadFactory.CreateConcat(data, info);
+ std::unique_ptr<IWorkload> workload = workloadFactory.CreateConcat(data, info);
inputHandle1->Allocate();
inputHandle2->Allocate();
}
LayerTestResult<uint16_t, 3> ConcatUint16Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
unsigned int outputWidth = 3;
unsigned int outputHeight = 6;
unsigned int inputChannels2 = 1;
// Defines the tensor descriptors.
- armnn::TensorInfo outputTensorInfo({ outputChannels, outputHeight, outputWidth }, armnn::DataType::QuantisedSymm16);
- armnn::TensorInfo inputTensorInfo1({ inputChannels1, inputHeight1, inputWidth1 }, armnn::DataType::QuantisedSymm16);
- armnn::TensorInfo inputTensorInfo2({ inputChannels2, inputHeight2, inputWidth2 }, armnn::DataType::QuantisedSymm16);
+ TensorInfo outputTensorInfo({ outputChannels, outputHeight, outputWidth }, DataType::QuantisedSymm16);
+ TensorInfo inputTensorInfo1({ inputChannels1, inputHeight1, inputWidth1 }, DataType::QuantisedSymm16);
+ TensorInfo inputTensorInfo2({ inputChannels2, inputHeight2, inputWidth2 }, DataType::QuantisedSymm16);
// Arbitrary scale and offsets. They don't really matter as the Concat operator doesn't dequantize/quantize them.
const float scale = 0.13497836f;
}));
std::vector<unsigned int> wOrigin1 = { 0, 0, 0 }; //Extent of the window is defined by size of input[0].
- armnn::ConcatQueueDescriptor::ViewOrigin window1(wOrigin1);
+ ConcatQueueDescriptor::ViewOrigin window1(wOrigin1);
std::vector<unsigned int> wOrigin2 = { 2, 0, 0 }; //Extent of the window is defined by size of input[1].
- armnn::ConcatQueueDescriptor::ViewOrigin window2(wOrigin2);
+ ConcatQueueDescriptor::ViewOrigin window2(wOrigin2);
- std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
+ std::unique_ptr<ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
bool subTensorsSupported = workloadFactory.SupportsSubTensors();
- std::unique_ptr<armnn::ITensorHandle> inputHandle1 =
+ std::unique_ptr<ITensorHandle> inputHandle1 =
subTensorsSupported ?
workloadFactory.CreateSubTensorHandle(*outputHandle, inputTensorInfo1.GetShape(), wOrigin1.data()) :
workloadFactory.CreateTensorHandle(inputTensorInfo1);
- std::unique_ptr<armnn::ITensorHandle> inputHandle2 =
+ std::unique_ptr<ITensorHandle> inputHandle2 =
subTensorsSupported ?
workloadFactory.CreateSubTensorHandle(*outputHandle, inputTensorInfo2.GetShape(), wOrigin2.data()) :
workloadFactory.CreateTensorHandle(inputTensorInfo2);
- armnn::ConcatQueueDescriptor data;
- armnn::WorkloadInfo info;
+ ConcatQueueDescriptor data;
+ WorkloadInfo info;
AddInputToWorkload(data, info, inputTensorInfo1, inputHandle1.get());
AddInputToWorkload(data, info, inputTensorInfo2, inputHandle2.get());
AddOutputToWorkload(data, info, outputTensorInfo, outputHandle.get());
data.m_ViewOrigins.push_back(window1);
data.m_ViewOrigins.push_back(window2);
- std::unique_ptr<armnn::IWorkload> workload = workloadFactory.CreateConcat(data, info);
+ std::unique_ptr<IWorkload> workload = workloadFactory.CreateConcat(data, info);
inputHandle1->Allocate();
inputHandle2->Allocate();
}
LayerTestResult<uint8_t, 1> Concat1dUint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat1dTestImpl<armnn::DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
+ return Concat1dTestImpl<DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
}
LayerTestResult<uint8_t, 2> Concat2dDim0Uint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat2dDim0TestImpl<armnn::DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
+ return Concat2dDim0TestImpl<DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
}
LayerTestResult<uint8_t, 2> Concat2dDim1Uint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat2dDim1TestImpl<armnn::DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
+ return Concat2dDim1TestImpl<DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
}
LayerTestResult<uint8_t, 2> Concat2dDim0DiffInputDimsUint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat2dDim0DiffInputDimsTestImpl<armnn::DataType::QuantisedAsymm8>(
+ return Concat2dDim0DiffInputDimsTestImpl<DataType::QuantisedAsymm8>(
workloadFactory, memoryManager, 0.5f, -1);
}
LayerTestResult<uint8_t, 2> Concat2dDim1DiffInputDimsUint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat2dDim1DiffInputDimsTestImpl<armnn::DataType::QuantisedAsymm8>(
+ return Concat2dDim1DiffInputDimsTestImpl<DataType::QuantisedAsymm8>(
workloadFactory, memoryManager, 0.5f, -1);
}
LayerTestResult<uint8_t, 3> Concat3dDim0Uint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat3dDim0TestImpl<armnn::DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
+ return Concat3dDim0TestImpl<DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
}
LayerTestResult<uint8_t, 3> Concat3dDim1Uint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat3dDim1TestImpl<armnn::DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
+ return Concat3dDim1TestImpl<DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
}
LayerTestResult<uint8_t, 3> Concat3dDim2Uint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
bool useSubtensor)
{
- return Concat3dDim2TestImpl<armnn::DataType::QuantisedAsymm8>(
+ return Concat3dDim2TestImpl<DataType::QuantisedAsymm8>(
workloadFactory, memoryManager, useSubtensor, 0.5f, -1);
}
LayerTestResult<uint8_t, 3> Concat3dDim0DiffInputDimsUint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat3dDim0TestImpl<armnn::DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
+ return Concat3dDim0TestImpl<DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
}
LayerTestResult<uint8_t, 3> Concat3dDim1DiffInputDimsUint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat3dDim1DiffInputDimsTestImpl<armnn::DataType::QuantisedAsymm8>(
+ return Concat3dDim1DiffInputDimsTestImpl<DataType::QuantisedAsymm8>(
workloadFactory, memoryManager, 0.5f, -1);
}
LayerTestResult<uint8_t, 3> Concat3dDim2DiffInputDimsUint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
bool useSubtensor)
{
- return Concat3dDim2DiffInputDimsTestImpl<armnn::DataType::QuantisedAsymm8>(
+ return Concat3dDim2DiffInputDimsTestImpl<DataType::QuantisedAsymm8>(
workloadFactory, memoryManager, useSubtensor, 0.5f, -1);
}
LayerTestResult<uint8_t, 4> Concat4dDim0Uint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat4dDim0TestImpl<armnn::DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
+ return Concat4dDim0TestImpl<DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
}
LayerTestResult<uint8_t, 4> Concat4dDim1Uint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat4dDim1TestImpl<armnn::DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
+ return Concat4dDim1TestImpl<DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
}
LayerTestResult<uint8_t, 4> Concat4dDim2Uint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat4dDim2TestImpl<armnn::DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
+ return Concat4dDim2TestImpl<DataType::QuantisedAsymm8>(workloadFactory, memoryManager, 0.5f, -1);
}
LayerTestResult<uint8_t, 4> Concat4dDim3Uint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool useSubtensor)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager, bool useSubtensor)
{
- return Concat4dDim3TestImpl<armnn::DataType::QuantisedAsymm8>(
+ return Concat4dDim3TestImpl<DataType::QuantisedAsymm8>(
workloadFactory, memoryManager, 0.5f, -1, useSubtensor);
}
LayerTestResult<uint8_t, 4> Concat4dDiffShapeDim0Uint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat4dDiffShapeDim0TestImpl<armnn::DataType::QuantisedAsymm8>(
+ return Concat4dDiffShapeDim0TestImpl<DataType::QuantisedAsymm8>(
workloadFactory, memoryManager, 0.5f, -1);
}
LayerTestResult<uint8_t, 4> Concat4dDiffShapeDim1Uint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat4dDiffShapeDim1TestImpl<armnn::DataType::QuantisedAsymm8>(
+ return Concat4dDiffShapeDim1TestImpl<DataType::QuantisedAsymm8>(
workloadFactory, memoryManager, 0.5f, -1);
}
LayerTestResult<uint8_t, 4> Concat4dDiffShapeDim2Uint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager)
{
- return Concat4dDiffShapeDim2TestImpl<armnn::DataType::QuantisedAsymm8>(
+ return Concat4dDiffShapeDim2TestImpl<DataType::QuantisedAsymm8>(
workloadFactory, memoryManager, 0.5f, -1);
}
LayerTestResult<uint8_t, 4> Concat4dDiffShapeDim3Uint8Test(
- armnn::IWorkloadFactory& workloadFactory,
- const armnn::IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
+ IWorkloadFactory& workloadFactory,
+ const IBackendInternal::IMemoryManagerSharedPtr& memoryManager,
bool useSubtensor)
{
- return Concat4dDiffShapeDim3TestImpl<armnn::DataType::QuantisedAsymm8>(
+ return Concat4dDiffShapeDim3TestImpl<DataType::QuantisedAsymm8>(
workloadFactory, memoryManager, 0.5f, -1, useSubtensor);
}
#include "ConstantTestImpl.hpp"
#include <Permute.hpp>
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <armnn/ArmNN.hpp>
}
auto input = MakeTensor<T, 4>(inputTensorInfo, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
- // Batch 0, Channel 0
- 235.0f, 46.0f, 178.0f,
- 100.0f, 123.0f, 19.0f,
- 172.0f, 74.0f, 250.0f,
- 6.0f, 195.0f, 80.0f,
-
- // Batch 0, Channel 1
- 113.0f, 95.0f, 202.0f,
- 77.0f, 114.0f, 71.0f,
- 122.0f, 246.0f, 166.0f,
- 82.0f, 28.0f, 37.0f,
-
- // Batch 0, Channel 2
- 56.0f, 170.0f, 162.0f,
- 194.0f, 89.0f, 254.0f,
- 12.0f, 209.0f, 200.0f,
- 1.0f, 64.0f, 54.0f,
-
- // Batch 1, Channel 0
- 67.0f, 90.0f, 49.0f,
- 7.0f, 163.0f, 18.0f,
- 25.0f, 117.0f, 103.0f,
- 247.0f, 59.0f, 189.0f,
-
- // Batch 1, Channel 1
- 239.0f, 104.0f, 199.0f,
- 17.0f, 124.0f, 153.0f,
- 222.0f, 217.0f, 75.0f,
- 32.0f, 126.0f, 21.0f,
-
- // Batch 1, Channel 2
- 97.0f, 145.0f, 215.0f,
- 115.0f, 116.0f, 238.0f,
- 226.0f, 16.0f, 132.0f,
- 92.0f, 125.0f, 88.0f,
- })));
+ armnnUtils::QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0
+ 235.0f, 46.0f, 178.0f,
+ 100.0f, 123.0f, 19.0f,
+ 172.0f, 74.0f, 250.0f,
+ 6.0f, 195.0f, 80.0f,
+
+ // Batch 0, Channel 1
+ 113.0f, 95.0f, 202.0f,
+ 77.0f, 114.0f, 71.0f,
+ 122.0f, 246.0f, 166.0f,
+ 82.0f, 28.0f, 37.0f,
+
+ // Batch 0, Channel 2
+ 56.0f, 170.0f, 162.0f,
+ 194.0f, 89.0f, 254.0f,
+ 12.0f, 209.0f, 200.0f,
+ 1.0f, 64.0f, 54.0f,
+
+ // Batch 1, Channel 0
+ 67.0f, 90.0f, 49.0f,
+ 7.0f, 163.0f, 18.0f,
+ 25.0f, 117.0f, 103.0f,
+ 247.0f, 59.0f, 189.0f,
+
+ // Batch 1, Channel 1
+ 239.0f, 104.0f, 199.0f,
+ 17.0f, 124.0f, 153.0f,
+ 222.0f, 217.0f, 75.0f,
+ 32.0f, 126.0f, 21.0f,
+
+ // Batch 1, Channel 2
+ 97.0f, 145.0f, 215.0f,
+ 115.0f, 116.0f, 238.0f,
+ 226.0f, 16.0f, 132.0f,
+ 92.0f, 125.0f, 88.0f,
+ },
+ qScale, qOffset)));
LayerTestResult<T, 4> result(outputTensorInfo);
result.outputExpected = input;
#include <DataLayoutIndexed.hpp>
#include <Permute.hpp>
+#include <QuantizeHelper.hpp>
#include <TensorUtils.hpp>
#include <armnn/ArmNN.hpp>
#include <backendsCommon/CpuTensorHandle.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
#include <backendsCommon/test/TensorCopyUtils.hpp>
#include <backendsCommon/test/WorkloadTestUtils.hpp>
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
});
+using namespace armnnUtils;
+
//
// Helper templates
//
if(biasEnabled)
{
armnn::TensorInfo biasDesc({static_cast<unsigned int>(Bias2.size())}, ArmnnType);
- boost::multi_array<T, 1> bias = MakeTensor<T, 1>(biasDesc, QuantizedVector<T>(qScale, 0.0f, Bias2));
+ boost::multi_array<T, 1> bias = MakeTensor<T, 1>(biasDesc, QuantizedVector<T>(Bias2, qScale, 0.0f));
return bias;
}
else
if(biasEnabled)
{
armnn::TensorInfo biasDesc({static_cast<unsigned int>(Bias4.size())}, ArmnnType);
- boost::multi_array<T, 1> bias = MakeTensor<T, 1>(biasDesc, QuantizedVector<T>(qScale, 0.0f, Bias4));
+ boost::multi_array<T, 1> bias = MakeTensor<T, 1>(biasDesc, QuantizedVector<T>(Bias4, qScale, 0.0f));
return bias;
}
else
if(biasEnabled)
{
armnn::TensorInfo biasDesc({static_cast<unsigned int>(Bias4.size())}, ArmnnType);
- boost::multi_array<T, 1> bias = MakeTensor<T, 1>(biasDesc, QuantizedVector<T>(qScale, 0.0f, Bias8));
+ boost::multi_array<T, 1> bias = MakeTensor<T, 1>(biasDesc, QuantizedVector<T>(Bias8, qScale, 0.0f));
return bias;
}
else
biasInfo.SetQuantizationOffset(0);
}
- std::vector<T> inputData(
- QuantizedVector<T>(inputInfo.GetQuantizationScale(), inputInfo.GetQuantizationOffset(), {
- 5.0f, -2.0f, 2.5f, 0.0f, 1.0f,
- -3.0f, 3.2f, 5.0f, 2.0f, 3.0f,
- }));
+ std::vector<T> inputData = QuantizedVector<T>(
+ {
+ 5.0f, -2.0f, 2.5f, 0.0f, 1.0f,
+ -3.0f, 3.2f, 5.0f, 2.0f, 3.0f,
+ },
+ inputInfo.GetQuantizationScale(),
+ inputInfo.GetQuantizationOffset());
- std::vector<T> kernelData(
- QuantizedVector<T>(kernelInfo.GetQuantizationScale(), kernelInfo.GetQuantizationOffset(), {
- 1.0f, 0.0f, 0.0f,
- 0.0f, 2.0f, -1.5f,
+ std::vector<T> kernelData = QuantizedVector<T>(
+ {
+ 1.0f, 0.0f, 0.0f,
+ 0.0f, 2.0f, -1.5f,
- 0.0f, 0.0f, 0.0f,
- 0.2f, 0.2f, 0.2f,
+ 0.0f, 0.0f, 0.0f,
+ 0.2f, 0.2f, 0.2f,
- 0.5f, 0.0f, 0.5f,
- 0.0f, -1.0f, 0.0f
- }));
+ 0.5f, 0.0f, 0.5f,
+ 0.0f, -1.0f, 0.0f
+ },
+ kernelInfo.GetQuantizationScale(),
+ kernelInfo.GetQuantizationOffset());
- std::vector<B> biasData(
- QuantizedVector<B>(biasInfo.GetQuantizationScale(), biasInfo.GetQuantizationOffset(), {
- 1.0f, 0.0f, 0.0f
- }));
+ std::vector<B> biasData =
+ QuantizedVector<B>({ 1.0f, 0.0f, 0.0f }, biasInfo.GetQuantizationScale(), biasInfo.GetQuantizationOffset());
- std::vector<T> outputData(
- QuantizedVector<T>(outputInfo.GetQuantizationScale(), outputInfo.GetQuantizationOffset(), {
- 4.5f, -10.8f, 5.0f + 6.4f - 7.5f, -2.0f + 10.0f -3.0f, 2.5f + 4.0f - 4.5f, 6.0f, 1.0f,
+ std::vector<T> outputData = QuantizedVector<T>(
+ {
+ 4.5f, -10.8f, 5.0f + 6.4f - 7.5f, -2.0f + 10.0f -3.0f, 2.5f + 4.0f - 4.5f, 6.0f, 1.0f,
-0.6f, -0.6f + 0.64f, -0.6f + 0.64f + 1.0f, 0.64f + 1.0f + 0.4f, 1.0f + 0.4f + 0.6f, 0.4f + 0.6f, 0.6f,
- 2.5f, -1.0f + 3.0f, 1.25f - 3.2f + 2.5f, -1.0f - 5.0f, 1.25f + 0.5f - 2.0f, -3.0f, 0.5f
- }));
+ 2.5f, -1.0f + 3.0f, 1.25f - 3.2f + 2.5f, -1.0f - 5.0f, 1.25f + 0.5f - 2.0f, -3.0f, 0.5f
+ },
+ outputInfo.GetQuantizationScale(),
+ outputInfo.GetQuantizationOffset());
// Optionally apply bias to output image.
if(biasEnabled)
{
// Use common single-batch 3-channel 16x8 image.
armnn::TensorInfo inputDesc({1, 3, 8, 16}, ArmnnType);
- boost::multi_array<T, 4> input = MakeTensor<T, 4>(inputDesc, QuantizedVector<T>(qScale, qOffset, ConvInput3x8x16));
+ boost::multi_array<T, 4> input = MakeTensor<T, 4>(inputDesc, QuantizedVector<T>(ConvInput3x8x16, qScale, qOffset));
// Use a 2-element batch with 3-channel 3x5 kernels.
armnn::TensorInfo kernelDesc({2, 3, 5, 3}, ArmnnType);
boost::multi_array<T, 4> kernel = MakeTensor<T, 4>(kernelDesc, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
- 1, 1, 1,
+ QuantizedVector<T>({
+ 1, 1, 1,
1, -1, 1,
- 1, 1, 1,
- 1, 1, 1,
- 1, 1, 1,
-
- 0, 0, 0,
- 0, 0, 0,
- 0, 0, 0,
- 0, 0, 0,
- 0, 0, 0,
-
- 2, 2, 2,
- 2, 2, 2,
- 2, 2, 2,
- 2, 2, 2,
- 2, 2, 2,
-
-
- 0, 0, 0,
- 0, 0, 0,
- 0, 0, 0,
- 0, 0, 0,
- 0, 0, 0,
-
- 1, 1, 1,
- 1, 1, 1,
- 1, 1, 1,
- 1, 1, 1,
- 1, 1, 1,
-
- 0, 0, 0,
- 0, 0, 0,
- 0, 0, 0,
- 0, 0, 0,
- 0, 0, 0
- })));
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+
+ 2, 2, 2,
+ 2, 2, 2,
+ 2, 2, 2,
+ 2, 2, 2,
+ 2, 2, 2,
+
+
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0
+ },
+ qScale, qOffset)));
// Expected output is 2 batch elements of a 1-channel 14x4 image.
armnn::TensorInfo outputDesc({1, 2, 4, 14}, ArmnnType);
boost::multi_array<T, 4> expectedOutput = MakeTensor<T, 4>(outputDesc, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
-24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24,
-25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, -25,
-23.5f, -23.5f, -23.5f, -23.5f, -23.5f, -23.5f, -23.5f, -23.5f, -23.5f, -23.5f, -23.5f,
5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- })));
+ },
+ qScale, qOffset)));
return SimpleConvolution2dTestImpl<ArmnnType, ArmnnBType>(
workloadFactory,
// Use common single-batch 3-channel 16x8 image.
armnn::TensorInfo inputDesc({1, 3, 8, 16}, ArmnnType);
- boost::multi_array<T, 4> input = MakeTensor<T, 4>(inputDesc, QuantizedVector<T>(qScale, qOffset, ConvInput3x8x16));
+ boost::multi_array<T, 4> input = MakeTensor<T, 4>(inputDesc, QuantizedVector<T>(ConvInput3x8x16, qScale, qOffset));
// Use a 2-element batch of 3-channel 3x3 kernels.
armnn::TensorInfo kernelDesc({2, 3, 3, 3}, ArmnnType);
boost::multi_array<T, 4> kernel = MakeTensor<T, 4>(kernelDesc, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
- 1, 1, 1,
+ QuantizedVector<T>({
+ 1, 1, 1,
1, -1, 1,
- 1, 1, 1,
+ 1, 1, 1,
- 0, 0, 0,
- 0, 0, 0,
- 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
- 2, 2, 2,
- 2, 2, 2,
- 2, 2, 2,
+ 2, 2, 2,
+ 2, 2, 2,
+ 2, 2, 2,
- 0, 0, 0,
- 0, 0, 0,
- 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
- 1, 1, 1,
- 1, 1, 1,
- 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
- 0, 0, 0,
- 0, 0, 0,
- 0, 0, 0
- })));
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0
+ },
+ qScale, qOffset)));
// Expected output is 1 batch of a 2-channel 14x6 image.
armnn::TensorInfo outputDesc({1, 2, 6, 14}, ArmnnType);
boost::multi_array<T, 4> expectedOutput = MakeTensor<T, 4>(outputDesc, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
-15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
-16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16,
-14.5f,-14.5f,-14.5f,-14.5f,-14.5f,-14.5f,-14.5f,-14.5f,-14.5f,-14.5f,-14.5f,-14.5f,-14.5f,-14.5f,
3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- })));
+ },
+ qScale, qOffset)));
return SimpleConvolution2dTestImpl<ArmnnType, ArmnnBType>(
workloadFactory,
// Use a single-batch 1-channel 3x3 image as input.
armnn::TensorInfo inputDesc({1, 1, 3, 3}, ArmnnType);
boost::multi_array<T, 4> input = MakeTensor<T, 4>(inputDesc, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
11,21,31,
12,22,32,
13,23,33
- })));
+ },
+ qScale, qOffset)));
// Use 1 batch of a 1-channel 2x2 kernel.
armnn::TensorInfo kernelDesc({1, 1, 2, 2}, ArmnnType);
boost::multi_array<T, 4> kernel = MakeTensor<T, 4>(kernelDesc, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
-11,-21,
-12,-22,
- })));
+ },
+ qScale, qOffset)));
// Expected output is 1 batch of a 1-channel 6x8 image.
// Manually calculated like this:
//[..... ..... ..... ..... ; ..... ..... ..... ..... ; ..... ..... ..... ..... ; ..... ..... ..... ..... ..]
armnn::TensorInfo outputDesc({1, 1, 8, 6}, ArmnnType);
boost::multi_array<T, 4> expectedOutput = MakeTensor<T, 4>(outputDesc, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
0, 0, 0, 0, 0, 0,
-242, -594, -934, -372, 0, 0,
-495, -1190, -1850, -725, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0
- })));
+ },
+ qScale, qOffset)));
return SimpleConvolution2dTestImpl<ArmnnType, ArmnnBType>(
workloadFactory,
// Use a single-batch 1-channel 5x5 image as input.
armnn::TensorInfo inputDesc({ 1, 1, 5, 5 }, ArmnnType);
boost::multi_array<T, 4> input = MakeTensor<T, 4>(inputDesc, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
11,21,31,41,51,
12,22,32,42,52,
13,23,33,43,53,
14,24,34,44,54,
15,25,35,45,55,
- })));
+ }, qScale, qOffset)));
// Use 1 batch of a 1-channel 4x4 kernel.
armnn::TensorInfo kernelDesc({ 1, 1, 4, 4 }, ArmnnType);
boost::multi_array<T, 4> kernel = MakeTensor<T, 4>(kernelDesc, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
-11,-21,-31,-41,
-12,-22,-32,-42,
-13,-23,-33,-43,
-14,-24,-34,-44,
- })));
+ },
+ qScale, qOffset)));
// Expected output is 1 batch of a 1-channel 5x5 image.
armnn::TensorInfo outputDesc({ 1, 1, 5, 5 }, ArmnnType);
std::vector<T> myVec(outputDesc.GetNumElements(), 0);
boost::multi_array<T, 4> expectedOutput = MakeTensor<T, 4>(outputDesc, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
-7140, -10580, -13940, -9300, -5230,
-9590, -14120, -18520, -12290, -6860,
-9980, -14560, -18960, -12560, -7000,
-7518, -10904, -14144, -9318, -5152,
-5032, -7256, -9376, -6142, -3368,
- })));
+ },
+ qScale, qOffset)));
return SimpleConvolution2dTestImpl<ArmnnType, ArmnnBType>(
workloadFactory,
outputTensorInfo.SetQuantizationOffset(qOffset);
auto input = MakeTensor<T, 4>(inputTensorInfo,
- std::vector<T>(QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(),
- inputTensorInfo.GetQuantizationOffset(),
- inputNoQuantizedValues)));
+ std::vector<T>(QuantizedVector<T>(inputNoQuantizedValues,
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset())));
auto kernel = MakeTensor<T, 4>(kernelTensorInfo,
- std::vector<T>(QuantizedVector<T>(kernelTensorInfo.GetQuantizationScale(),
- kernelTensorInfo.GetQuantizationOffset(),
- kernelNoQuantizedValues)));
- auto expectedOutput = MakeTensor<T, 4>(outputTensorInfo,
- std::vector<T>(QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(),
- outputTensorInfo.GetQuantizationOffset(),
- outputExpectedNoQuantizedValues)));
+ std::vector<T>(QuantizedVector<T>(kernelNoQuantizedValues,
+ kernelTensorInfo.GetQuantizationScale(),
+ kernelTensorInfo.GetQuantizationOffset())));
+ auto expectedOutput =
+ MakeTensor<T, 4>(outputTensorInfo,
+ std::vector<T>(QuantizedVector<T>(outputExpectedNoQuantizedValues,
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset())));
return SimpleConvolution2dTestImpl<ArmnnType, ArmnnBType>(
workloadFactory,
biasDesc.SetQuantizationOffset(0);
}
std::vector<T> inputData = std::vector<T>(
- QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(), {
- 1.f, 2.f, 1.f,
- 2.f, 1.f, 2.f,
- 1.f, 2.f, 1.f,
-
- 1.f, 2.f, 1.f,
- 2.f, 1.f, 2.f,
- 1.f, 2.f, 1.f,
- }));
+ QuantizedVector<T>({
+ 1.f, 2.f, 1.f,
+ 2.f, 1.f, 2.f,
+ 1.f, 2.f, 1.f,
+
+ 1.f, 2.f, 1.f,
+ 2.f, 1.f, 2.f,
+ 1.f, 2.f, 1.f,
+ },
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset()));
+
// at this point if we require it permute the input data
const armnn::PermutationVector NCHWToNHWC = { 0, 3, 1, 2 };
if (layout == armnn::DataLayout::NHWC)
}
auto input = MakeTensor<T, 4>(inputTensorInfo, inputData);
- std::vector<B> biasV(QuantizedVector<B>(biasDesc.GetQuantizationScale(), biasDesc.GetQuantizationOffset(),
- {0, 2}));
+ std::vector<B> biasV(QuantizedVector<B>({ 0, 2 },
+ biasDesc.GetQuantizationScale(),
+ biasDesc.GetQuantizationOffset()));
+
auto bias = MakeTensor<B, 1>(biasDesc, biasV);
std::vector<T> kernelData = std::vector<T>(
- QuantizedVector<T>(kernelDesc.GetQuantizationScale(), kernelDesc.GetQuantizationOffset(), {
- 1.f, 0.f, 1.f,
- 0.f, 0.f, 0.f,
- -1.f, 0.f, -1.f,
-
- 1.f, 0.f, 1.f,
- 0.f, 0.f, 0.f,
- -1.f, 0.f, -1.f,
- }));
+ QuantizedVector<T>({
+ 1.f, 0.f, 1.f,
+ 0.f, 0.f, 0.f,
+ -1.f, 0.f, -1.f,
+
+ 1.f, 0.f, 1.f,
+ 0.f, 0.f, 0.f,
+ -1.f, 0.f, -1.f,
+ },
+ kernelDesc.GetQuantizationScale(),
+ kernelDesc.GetQuantizationOffset()));
+
auto kernel = MakeTensor<T, 4>(kernelDesc, kernelData);
// Manually calculated.
std::vector<T> outputImage(
- QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(),
- outputTensorInfo.GetQuantizationOffset(),
- {0.f, 0.f})
+ QuantizedVector<T>({ 0.f, 0.f },
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset())
);
// Optionally apply bias to output image.
// NOTE: originalInputData is in NCHW format
std::vector<T> originalInputData = std::vector<T>(
- QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(), {
- 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
- 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
- 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
- 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
- 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
- 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
- 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- }));
+ QuantizedVector<T>({
+ 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
+ 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
+ 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
+ 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
+ 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
+ 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f,
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f
+ },
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset()));
+
std::vector<T> inputData = originalInputData;
// at this point if we require it permute the input data
const armnn::PermutationVector NCHWToNHWC = { 0, 3, 1, 2 };
}
auto input = MakeTensor<T, 4>(inputTensorInfo, inputData);
- std::vector<B> biasV(QuantizedVector<B>(biasDesc.GetQuantizationScale(), biasDesc.GetQuantizationOffset(),
- {0, 2, 1, -1}));
+ std::vector<B> biasV = QuantizedVector<B>({ 0, 2, 1, -1 },
+ biasDesc.GetQuantizationScale(),
+ biasDesc.GetQuantizationOffset());
+
auto bias = MakeTensor<B, 1>(biasDesc, biasV);
std::vector<T> kernelData = std::vector<T>(
- QuantizedVector<T>(kernelDesc.GetQuantizationScale(), kernelDesc.GetQuantizationOffset(), {
- 1, 1, 1,
- 1, -1, 1,
- 1, 1, 1,
- 1, 1, 1,
- 1, 1, 1,
-
- 2, 2, 2,
- 2, 2, 2,
- 2, 2, 2,
- 2, 2, 2,
- 2, 2, 2,
-
- 0, 0, 0,
- 0, -1, 0,
- 0, 0, 0,
- 0, 0, 0,
- 0, 0, 0,
-
- 0, 0, 0,
- 0, 0, 0,
- 0, 1, 0,
- 0, 0, 0,
- 0, 0, 0
-
- }));
+ QuantizedVector<T>({
+ 1, 1, 1,
+ 1, -1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1,
+
+ 2, 2, 2,
+ 2, 2, 2,
+ 2, 2, 2,
+ 2, 2, 2,
+ 2, 2, 2,
+
+ 0, 0, 0,
+ 0, -1, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 1, 0,
+ 0, 0, 0,
+ 0, 0, 0
+ },
+ kernelDesc.GetQuantizationScale(),
+ kernelDesc.GetQuantizationOffset()));
+
auto kernel = MakeTensor<T, 4>(kernelDesc, kernelData);
// Manually calculated.
std::vector<T> originalOutputImage = std::vector<T>(
- QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(), outputTensorInfo.GetQuantizationOffset(), {
- 3.5f, 3.5f, 3.5f, 3.5f, 3.5f, 3.5f, 3.5f,
- 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f,
- 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f,
- 6.5f, 6.5f, 6.5f, 6.5f, 6.5f, 6.5f, 6.5f,
- 6.5f, 6.5f, 6.5f, 6.5f, 6.5f, 6.5f, 6.5f,
- 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f,
+ QuantizedVector<T>({
+ 3.5f, 3.5f, 3.5f, 3.5f, 3.5f, 3.5f, 3.5f,
+ 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f, 6.0f,
+ 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f,
+ 6.5f, 6.5f, 6.5f, 6.5f, 6.5f, 6.5f, 6.5f,
+ 6.5f, 6.5f, 6.5f, 6.5f, 6.5f, 6.5f, 6.5f,
+ 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f,
-0.5f, -0.5f, -0.5f, -0.5f, -0.5f, -0.5f, -0.5f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
-0.5f, -0.5f, -0.5f, -0.5f, -0.5f, -0.5f, -0.5f,
-0.5f, -0.5f, -0.5f, -0.5f, -0.5f, -0.5f, -0.5f,
-0.5f, -0.5f, -0.5f, -0.5f, -0.5f, -0.5f, -0.5f,
-0.5f, -0.5f, -0.5f, -0.5f, -0.5f, -0.5f, -0.5f,
- 8.0f, 8.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 8.0f, 8.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
10.0f, 10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
10.0f, 10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
10.0f, 10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
10.0f, 10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 8.0f, 8.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
-
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f
- }));
+ 8.0f, 8.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f
+ },
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset()));
// Optionally apply bias to output image.
if(biasEnabled)
// Use a single-batch 2-channel 5x5 image as input.
armnn::TensorInfo inputTensorInfo({ 1, 2, 5, 5 }, ArmnnType);
auto input = MakeTensor<T, 4>(inputTensorInfo, std::vector<T>(
- QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(),
- {
+ QuantizedVector<T>({
0, 1, 2, 3, 4,
5, 6, 7, 8, 9,
10, 11, 12, 13, 14,
35, 36, 37, 38, 39,
40, 41, 42, 43, 44,
45, 46, 47, 48, 49
- })));
+ },
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset())));
// Use a depth multiplier of 1 on a 2-channel 4x4 kernel.
armnn::TensorInfo kernelTensorInfo({ 1, 2, 4, 4 }, ArmnnType);
auto kernel = MakeTensor<T, 4>(kernelTensorInfo, std::vector<T>(
- QuantizedVector<T>(kernelTensorInfo.GetQuantizationScale(), kernelTensorInfo.GetQuantizationOffset(),
- {
+ QuantizedVector<T>({
32, 31, 30, 29,
28, 27, 26, 25,
24, 23, 22, 21,
12, 11, 10, 9,
8, 7, 6, 5,
4, 3, 2, 1
- })));
+ },
+ kernelTensorInfo.GetQuantizationScale(),
+ kernelTensorInfo.GetQuantizationOffset())));
// Expected output is 1 batch of a 2-channel 5x5 image.
// Calculated using the python tensorflow library with strideX=1, strideY=1.
armnn::TensorInfo outputTensorInfo({ 1, 2, 5, 5 }, ArmnnType);
boost::multi_array<T, 4> expectedOutput = MakeTensor<T, 4>(outputTensorInfo, std::vector<T>(
- QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(), outputTensorInfo.GetQuantizationOffset(),
- {
+ QuantizedVector<T>({
1062, 1580, 1850, 1530, 1117,
2140, 3108, 3500, 2842, 2042,
3580, 5068, 5460, 4342, 3062,
3390, 4886, 5022, 4068, 2916,
3566, 5056, 5182, 4133, 2922,
3100, 4352, 4452, 3517, 2465
- })));
+ },
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset())));
return DepthwiseConvolution2dAsymmetricTestImpl<ArmnnType, ArmnnBType>(
workloadFactory,
armnn::TensorInfo inputTensorInfo({ 1, 2, 5, 5}, ArmnnType);
auto input = MakeTensor<T, 4>(inputTensorInfo, std::vector<T>(
- QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(),
- {
+ QuantizedVector<T>({
0, 1, 2, 3, 4,
5, 6, 7, 8, 9,
10, 11, 12, 13, 14,
35, 36, 37, 38, 39,
40, 41, 42, 43, 44,
45, 46, 47, 48, 49
- })));
+ },
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset())));
armnn::TensorInfo kernelTensorInfo({ 1, 2, 4, 4 }, ArmnnType);
auto kernel = MakeTensor<T, 4>(kernelTensorInfo, std::vector<T>(
- QuantizedVector<T>(kernelTensorInfo.GetQuantizationScale(), kernelTensorInfo.GetQuantizationOffset(),
- {
+ QuantizedVector<T>({
32, 31, 30, 29,
28, 27, 26, 25,
24, 23, 22, 21,
12, 11, 10, 9,
8, 7, 6, 5,
4, 3, 2, 1
- })));
+ },
+ kernelTensorInfo.GetQuantizationScale(),
+ kernelTensorInfo.GetQuantizationOffset())));
armnn::TensorInfo outputTensorInfo({ 1, 2, 5, 5}, ArmnnType);
boost::multi_array<T, 4> expectedOutput = MakeTensor<T, 4>(outputTensorInfo, std::vector<T>(
- QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(), outputTensorInfo.GetQuantizationOffset(),
- {
+ QuantizedVector<T>({
1062, 1580, 1850, 1530, 1117,
2140, 3108, 3500, 2842, 2042,
3580, 5068, 5460, 4342, 3062,
3390, 4886, 5022, 4068, 2916,
3566, 5056, 5182, 4133, 2922,
3100, 4352, 4452, 3517, 2465
- })));
+ },
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset())));
return DepthwiseConvolution2dTestImpl<ArmnnType, ArmnnBType>(
workloadFactory,
armnn::TensorInfo inputTensorInfo({ 1, 1, 9, 9}, ArmnnType);
auto input = MakeTensor<T, 4>(inputTensorInfo, std::vector<T>(
- QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(), inputTensorInfo.GetQuantizationOffset(),
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0
- })));
+ QuantizedVector<T>({
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0
+ },
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset())));
armnn::TensorInfo kernelTensorInfo({ 1, 1, 3, 3}, ArmnnType);
auto kernel = MakeTensor<T, 4>(kernelTensorInfo, std::vector<T>(
- QuantizedVector<T>(kernelTensorInfo.GetQuantizationScale(), kernelTensorInfo.GetQuantizationOffset(),
- {
- 1, 2, 3,
- 4, 5, 6,
- 7, 8, 9
- })));
+ QuantizedVector<T>({
+ 1, 2, 3,
+ 4, 5, 6,
+ 7, 8, 9
+ },
+ kernelTensorInfo.GetQuantizationScale(),
+ kernelTensorInfo.GetQuantizationOffset())));
uint32_t padLeft = 0;
uint32_t padTop = 0;
// Since the dilation rate is 3 this will reduce the size of the output from 9x9 to 3x3 of all 5s.
armnn::TensorInfo outputTensorInfo({ 1, 1, 3, 3}, ArmnnType);
boost::multi_array<T, 4> expectedOutput = MakeTensor<T, 4>(outputTensorInfo, std::vector<T>(
- QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(), outputTensorInfo.GetQuantizationOffset(),
- {
- 5, 5, 5,
- 5, 5, 5,
- 5, 5, 5
- })));
+ QuantizedVector<T>({
+ 5, 5, 5,
+ 5, 5, 5,
+ 5, 5, 5
+ },
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset())));
return DepthwiseConvolution2dTestImpl<ArmnnType, ArmnnBType>(
workloadFactory,
outputTensorInfo.SetQuantizationOffset(qOffset);
auto input = MakeTensor<T, 4>(inputTensorInfo,
- std::vector<T>(QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(),
- inputTensorInfo.GetQuantizationOffset(),
- inputNoQuantizedValues)));
+ std::vector<T>(QuantizedVector<T>(inputNoQuantizedValues,
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset())));
auto kernel = MakeTensor<T, 4>(kernelTensorInfo,
- std::vector<T>(QuantizedVector<T>(kernelTensorInfo.GetQuantizationScale(),
- kernelTensorInfo.GetQuantizationOffset(),
- kernelNoQuantizedValues)));
- auto expectedOutput = MakeTensor<T, 4>(outputTensorInfo,
- std::vector<T>(QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(),
- outputTensorInfo.GetQuantizationOffset(),
- outputExpectedNoQuantizedValues)));
+ std::vector<T>(QuantizedVector<T>(kernelNoQuantizedValues,
+ kernelTensorInfo.GetQuantizationScale(),
+ kernelTensorInfo.GetQuantizationOffset())));
+ auto expectedOutput =
+ MakeTensor<T, 4>(outputTensorInfo,
+ std::vector<T>(QuantizedVector<T>(outputExpectedNoQuantizedValues,
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset())));
uint32_t padLeft = 0;
uint32_t padTop = 0;
#include "DebugTestImpl.hpp"
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <armnn/ArmNN.hpp>
}
boost::multi_array<T, Dim> input =
- MakeTensor<T, Dim>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, inputData));
+ MakeTensor<T, Dim>(inputTensorInfo, armnnUtils::QuantizedVector<T>(inputData, qScale, qOffset));
LayerTestResult<T, Dim> ret(outputTensorInfo);
ret.outputExpected =
- MakeTensor<T, Dim>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, outputExpectedData));
+ MakeTensor<T, Dim>(outputTensorInfo, armnnUtils::QuantizedVector<T>(outputExpectedData, qScale, qOffset));
std::unique_ptr<armnn::ITensorHandle> inputHandle =
workloadFactory.CreateTensorHandle(inputTensorInfo);
#include "DepthToSpaceTestImpl.hpp"
-#include <Permute.hpp>
+#include <QuantizeHelper.hpp>
#include <armnn/ArmNN.hpp>
outputInfo.SetQuantizationOffset(qOffset);
}
- boost::multi_array<T, 4> input = MakeTensor<T, 4>(inputInfo, QuantizedVector<T>(qScale, qOffset, inputData));
+ boost::multi_array<T, 4> input =
+ MakeTensor<T, 4>(inputInfo, armnnUtils::QuantizedVector<T>(inputData, qScale, qOffset));
LayerTestResult<T, 4> result(outputInfo);
- result.outputExpected = MakeTensor<T, 4>(outputInfo, QuantizedVector<T>(qScale, qOffset, expectedOutputData));
+ result.outputExpected =
+ MakeTensor<T, 4>(outputInfo, armnnUtils::QuantizedVector<T>(expectedOutputData, qScale, qOffset));
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputInfo);
std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputInfo);
#include <armnn/ArmNN.hpp>
+#include <QuantizeHelper.hpp>
+
#include <backendsCommon/CpuTensorHandle.hpp>
#include <backendsCommon/test/DataTypeUtils.hpp>
LayerTestResult<T, 2> result(outputTensorInfo);
boost::multi_array<T, 4> input = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ armnnUtils::QuantizedVector<T>({
1.0f, 10.0f, 100.0f, 1000.0f, 10000.0f,
- })
+ },
+ qScale, qOffset)
);
boost::multi_array<T, 2> weights = MakeTensor<T, 2>(weightsDesc,
- QuantizedVector<T>(qScale, qOffset, {
+ armnnUtils::QuantizedVector<T>({
2.0f, 3.0f, 4.0f, 5.0f, 6.0f
- })
+ },
+ qScale, qOffset)
);
std::vector<T> biasValues({900000.f});
);
result.outputExpected = MakeTensor<T, 2>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
- 965432.0f,
- })
- );
+ armnnUtils::QuantizedVector<T>({ 965432.0f }, qScale, qOffset));
return result;
}
#include "InstanceNormalizationTestImpl.hpp"
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <armnn/ArmNN.hpp>
#include <backendsCommon/WorkloadFactory.hpp>
#include <backendsCommon/test/DataLayoutUtils.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
#include <backendsCommon/test/TensorCopyUtils.hpp>
#include <backendsCommon/test/WorkloadTestUtils.hpp>
float qScale = 0.0f,
int32_t qOffset = 0)
{
- auto inputTensor = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, inputValues));
+ auto inputTensor = MakeTensor<T, 4>(inputTensorInfo,
+ armnnUtils::QuantizedVector<T>(inputValues, qScale, qOffset));
LayerTestResult<T, 4> result(outputTensorInfo);
-
- result.outputExpected =
- MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, expectedOutputValues));
+ result.outputExpected = MakeTensor<T, 4>(outputTensorInfo,
+ armnnUtils::QuantizedVector<T>(expectedOutputValues, qScale, qOffset));
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
#include "L2NormalizationTestImpl.hpp"
#include <Permute.hpp>
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <TensorUtils.hpp>
inputData = tmp;
}
- auto inputTensor = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(
- inputTensorInfo.GetQuantizationScale(),
- inputTensorInfo.GetQuantizationOffset(),
- inputData));
+ auto inputTensor = MakeTensor<T, 4>(inputTensorInfo,
+ armnnUtils::QuantizedVector<T>(inputData,
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset()));
std::vector<float> expectedOutputData = expectedOutputValues;
if (layout == armnn::DataLayout::NHWC)
}
LayerTestResult<T, 4> result(outputTensorInfo);
- result.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(
- outputTensorInfo.GetQuantizationScale(),
- outputTensorInfo.GetQuantizationOffset(),
- expectedOutputData));
+ result.outputExpected =
+ MakeTensor<T, 4>(outputTensorInfo,
+ armnnUtils::QuantizedVector<T>(expectedOutputData,
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset()));
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
const armnn::TensorInfo inputTensorInfo(inputOutputTensorShape, armnn::DataType::Float32, 0.f, 0);
const armnn::TensorInfo outputTensorInfo(inputOutputTensorShape, armnn::DataType::Float32, 0.f, 0);
- auto inputTensor = MakeTensor<float, 2>(inputTensorInfo, QuantizedVector<float>(
- inputTensorInfo.GetQuantizationScale(),
- inputTensorInfo.GetQuantizationOffset(),
- inputData));
+ auto inputTensor = MakeTensor<float, 2>(inputTensorInfo, inputData);
LayerTestResult<float, 2> result(outputTensorInfo);
- result.outputExpected = MakeTensor<float, 2>(outputTensorInfo, QuantizedVector<float>(
- outputTensorInfo.GetQuantizationScale(),
- outputTensorInfo.GetQuantizationOffset(),
- expectedOutputData));
+ result.outputExpected = MakeTensor<float, 2>(outputTensorInfo, expectedOutputData);
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
#include "LogSoftmaxTestImpl.hpp"
#include <Half.hpp>
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <armnn/ArmNN.hpp>
#include <backendsCommon/IBackendInternal.hpp>
#include <backendsCommon/WorkloadFactory.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
#include <backendsCommon/test/TensorCopyUtils.hpp>
#include <backendsCommon/test/WorkloadTestUtils.hpp>
{
LayerTestResult<T, NumDims> result(outputInfo);
result.outputExpected =
- MakeTensor<T, NumDims>(outputInfo, QuantizedVector<T>(qScale, qOffset, expectedOutputValues));
+ MakeTensor<T, NumDims>(outputInfo, armnnUtils::QuantizedVector<T>(expectedOutputValues, qScale, qOffset));
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputInfo);
std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputInfo);
inputHandle->Allocate();
outputHandle->Allocate();
- auto inputTensor = MakeTensor<T, NumDims>(inputInfo, QuantizedVector<T>(qScale, qOffset, inputValues));
+ auto inputTensor = MakeTensor<T, NumDims>(inputInfo, armnnUtils::QuantizedVector<T>(inputValues, qScale, qOffset));
CopyDataToITensorHandle(inputHandle.get(), inputTensor.origin());
workload->Execute();
#include "LstmTestImpl.hpp"
+#include <QuantizeHelper.hpp>
+
#include <armnn/ArmNN.hpp>
#include <backendsCommon/CpuTensorHandle.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
#include <backendsCommon/test/TensorCopyUtils.hpp>
#include <backendsCommon/test/WorkloadTestUtils.hpp>
const armnn::DataType constantDatatype = armnn::DataType::QuantisedAsymm8;
armnn::TensorInfo inputDesc({2, 2}, datatype);
- boost::multi_array<int16_t , 2> input = MakeTensor<int16_t , 2>(inputDesc, QuantizedVector<int16_t>(qScale, qOffset,
- std::vector<float>{2., 3., 3., 4.}));
+ boost::multi_array<int16_t , 2> input = MakeTensor<int16_t , 2>(
+ inputDesc,
+ armnnUtils::QuantizedVector<int16_t>({ 2.f, 3.f, 3.f, 4.f }, qScale, qOffset));
armnn::TensorInfo outputDesc({2, 4}, datatype);
- boost::multi_array<int16_t, 2> expectedOutput = MakeTensor<int16_t, 2>(outputDesc, QuantizedVector<int16_t>(qScale,
- qOffset, std::vector<float>({{-0.02973187f, 0.1229473f, 0.20885126f, -0.15358765f,
- -0.0185422f, 0.11281417f, 0.24466537f, -0.1826292f}})));
+ boost::multi_array<int16_t, 2> expectedOutput = MakeTensor<int16_t, 2>(
+ outputDesc,
+ armnnUtils::QuantizedVector<int16_t>(
+ {
+ -0.02973187f, 0.12294730f, 0.20885126f, -0.15358765f,
+ -0.01854220f, 0.11281417f, 0.24466537f, -0.18262920f
+ },
+ qScale, qOffset));
return LstmNoCifgNoPeepholeNoProjectionTestImpl<datatype>(
workloadFactory, memoryManager, input, expectedOutput, qScale, qOffset, constantDatatype);
const armnn::DataType constantDatatype = armnn::DataType::QuantisedAsymm8;
armnn::TensorInfo inputDesc({ 2, 2 }, datatype);
- boost::multi_array<int16_t, 2> input = MakeTensor<int16_t, 2>(inputDesc, QuantizedVector<int16_t>(qScale, qOffset,
- std::vector<float>({ 2., 3., 3., 4. })));
+ boost::multi_array<int16_t, 2> input =
+ MakeTensor<int16_t, 2>(
+ inputDesc,
+ armnnUtils::QuantizedVector<int16_t>({ 2.f, 3.f, 3.f, 4.f }, qScale, qOffset));
armnn::TensorInfo outputDesc({ 2, 4 }, datatype);
- boost::multi_array<int16_t, 2> expectedOutput = MakeTensor<int16_t, 2>(outputDesc, QuantizedVector<int16_t>(qScale,
- qOffset, std::vector<float>(
- {-0.36444446f, -0.00352185f, 0.12886585f, -0.05163646f,
- -0.42734814f, -0.00478661f, 0.13455015f, -0.03560682f})));
+ boost::multi_array<int16_t, 2> expectedOutput =
+ MakeTensor<int16_t, 2>(
+ outputDesc,
+ armnnUtils::QuantizedVector<int16_t>(
+ {
+ -0.36444446f, -0.00352185f, 0.12886585f, -0.05163646f,
+ -0.42734814f, -0.00478661f, 0.13455015f, -0.03560682f
+ },
+ qScale, qOffset));
return LstmLayerWithCifgWithPeepholeNoProjectionTestImpl<datatype>(
workloadFactory, memoryManager, input, expectedOutput, qScale, qOffset, constantDatatype);
const armnn::DataType constantDatatype = armnn::DataType::QuantisedAsymm8;
armnn::TensorInfo inputDesc({ 2, 5 }, datatype);
- boost::multi_array<int16_t, 2> input = MakeTensor<int16_t, 2>(inputDesc, QuantizedVector<int16_t>(qScale,
- qOffset, std::vector<float>(
- {0.787926f, 0.151646f, 0.071352f, 0.118426f, 0.458058f,
- 0.295743f, 0.544053f, 0.690064f, 0.858138f, 0.497181f})));
+ boost::multi_array<int16_t, 2> input =
+ MakeTensor<int16_t, 2>(
+ inputDesc,
+ armnnUtils::QuantizedVector<int16_t>(
+ {
+ 0.787926f, 0.151646f, 0.071352f, 0.118426f, 0.458058f,
+ 0.295743f, 0.544053f, 0.690064f, 0.858138f, 0.497181f
+ },
+ qScale, qOffset));
armnn::TensorInfo outputDesc({ 2, 16 }, datatype);
- boost::multi_array<int16_t, 2> expectedOutput = MakeTensor<int16_t, 2>(outputDesc, QuantizedVector<int16_t>(qScale,
- qOffset, std::vector<float>(
- {-0.00396806f, 0.029352f, -0.00279226f, 0.0159977f, -0.00835576f,
- -0.0211779f, 0.0283512f, -0.0114597f, 0.00907307f, -0.0244004f,
- -0.0152191f, -0.0259063f, 0.00914318f, 0.00415118f, 0.017147f,
- 0.0134203f, -0.013869f, 0.0287268f, -0.00334693f, 0.00733398f, -0.0287926f,
- -0.0186926f, 0.0193662f, -0.0115437f, 0.00422612f, -0.0345232f,
- 0.00223253f, -0.00957321f, 0.0210624f, 0.013331f, 0.0150954f, 0.02168f})));
+ boost::multi_array<int16_t, 2> expectedOutput =
+ MakeTensor<int16_t, 2>(
+ outputDesc,
+ armnnUtils::QuantizedVector<int16_t>(
+ {
+ -0.00396806f, 0.02935200f, -0.00279226f, 0.01599770f,
+ -0.00835576f, -0.02117790f, 0.02835120f, -0.01145970f,
+ 0.00907307f, -0.02440040f, -0.01521910f, -0.02590630f,
+ 0.00914318f, 0.00415118f, 0.01714700f, 0.01342030f,
+ -0.01386900f, 0.02872680f, -0.00334693f, 0.00733398f,
+ -0.02879260f, -0.01869260f, 0.01936620f, -0.01154370f,
+ 0.00422612f, -0.03452320f, 0.00223253f, -0.00957321f,
+ 0.02106240f, 0.01333100f, 0.01509540f, 0.02168000f
+ },
+ qScale, qOffset));
return LstmLayerNoCifgWithPeepholeWithProjectionTestImpl<datatype>(
workloadFactory, memoryManager, input, expectedOutput, qScale, qOffset, constantDatatype);
const armnn::DataType datatype = armnn::DataType::QuantisedSymm16; // datatype & constants set to QSymm16
armnn::TensorInfo inputDesc({2, 2}, datatype);
- boost::multi_array<int16_t , 2> input = MakeTensor<int16_t , 2>(inputDesc, QuantizedVector<int16_t>(qScale,
- qOffset, std::vector<float>{2., 3., 3., 4.}));
+ boost::multi_array<int16_t , 2> input =
+ MakeTensor<int16_t , 2>(inputDesc,
+ armnnUtils::QuantizedVector<int16_t>({ 2.f, 3.f, 3.f, 4.f }, qScale, qOffset));
armnn::TensorInfo outputDesc({2, 4}, datatype);
- boost::multi_array<int16_t, 2> expectedOutput = MakeTensor<int16_t, 2>(outputDesc, QuantizedVector<int16_t>(qScale,
- qOffset, std::vector<float>({{-0.02973187f, 0.1229473f, 0.20885126f, -0.15358765f,
- -0.0185422f, 0.11281417f, 0.24466537f, -0.1826292f}})));
+ boost::multi_array<int16_t, 2> expectedOutput =
+ MakeTensor<int16_t, 2>(
+ outputDesc,
+ armnnUtils::QuantizedVector<int16_t>(
+ {
+ -0.02973187f, 0.12294730f, 0.20885126f, -0.15358765f,
+ -0.01854220f, 0.11281417f, 0.24466537f, -0.18262920f
+ },
+ qScale, qOffset));
return LstmNoCifgNoPeepholeNoProjectionTestImpl<datatype>(
workloadFactory, memoryManager, input, expectedOutput, qScale, qOffset, datatype);
#include "PadTestImpl.hpp"
+#include <QuantizeHelper.hpp>
+
#include <backendsCommon/test/TensorCopyUtils.hpp>
#include <backendsCommon/test/WorkloadTestUtils.hpp>
const armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType, qScale, qOffset);
const armnn::TensorInfo outputTensorInfo(outputShape, ArmnnType, qScale, qOffset);
- std::vector<T> inputValues(
- QuantizedVector<T>(qScale, qOffset,
- {
- // Height (3) x Width (3)
- 4, 8, 6,
- 7, 4, 4,
- 3, 2, 4
- }));
+ std::vector<T> inputValues = armnnUtils::QuantizedVector<T>(
+ {
+ // Height (3) x Width (3)
+ 4, 8, 6,
+ 7, 4, 4,
+ 3, 2, 4
+ },
+ qScale, qOffset);
auto p = customPaddingValue;
- std::vector<T> expectedOutputValues;
- expectedOutputValues = (
- QuantizedVector<T>(qScale, qOffset,
- {
- p, p, p, p, p, p, p,
- p, p, p, p, p, p, p,
- p, p, 4, 8, 6, p, p,
- p, p, 7, 4, 4, p, p,
- p, p, 3, 2, 4, p, p,
- p, p, p, p, p, p, p,
- p, p, p, p, p, p, p
- }));
+ std::vector<T> expectedOutputValues = armnnUtils::QuantizedVector<T>(
+ {
+ p, p, p, p, p, p, p,
+ p, p, p, p, p, p, p,
+ p, p, 4, 8, 6, p, p,
+ p, p, 7, 4, 4, p, p,
+ p, p, 3, 2, 4, p, p,
+ p, p, p, p, p, p, p,
+ p, p, p, p, p, p, p
+ },
+ qScale, qOffset);
auto inputTensor = MakeTensor<T, 2>(inputTensorInfo, std::vector<T>(inputValues));
const armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType, qScale, qOffset);
const armnn::TensorInfo outputTensorInfo(outputShape, ArmnnType, qScale, qOffset);
- std::vector<T> inputValues(
- QuantizedVector<T>(qScale,qOffset,
- {
- // Channel 0, Height (2) x Width (2)
- 0, 4,
- 2, 5,
-
- // Channel 1, Height (2) x Width (2)
- 6, 1,
- 5, 2
- }));
-
- std::vector<T> expectedOutputValues(
- QuantizedVector<T>(qScale,qOffset,
- {
-
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 4, 0, 0,
- 0, 0, 2, 5, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 6, 1, 0, 0,
- 0, 0, 5, 2, 0, 0,
- 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0
-
- }));
+ std::vector<T> inputValues = armnnUtils::QuantizedVector<T>(
+ {
+ // Channel 0, Height (2) x Width (2)
+ 0, 4,
+ 2, 5,
+
+ // Channel 1, Height (2) x Width (2)
+ 6, 1,
+ 5, 2
+ },
+ qScale, qOffset);
+
+ std::vector<T> expectedOutputValues = armnnUtils::QuantizedVector<T>(
+ {
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 4, 0, 0,
+ 0, 0, 2, 5, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 6, 1, 0, 0,
+ 0, 0, 5, 2, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+ },
+ qScale, qOffset);
auto inputTensor = MakeTensor<T, 3>(inputTensorInfo, std::vector<T>(inputValues));
const armnn::TensorInfo inputTensorInfo(inputShape, ArmnnType, qScale, qOffset);
const armnn::TensorInfo outputTensorInfo(outputShape, ArmnnType, qScale, qOffset);
- std::vector<T> inputValues(
- QuantizedVector<T>(qScale,qOffset,
- {
- // Batch 0, Channel 0, Height (3) x Width (2)
- 0, 1,
- 2, 3,
- 4, 5,
-
- // Batch 0, Channel 1, Height (3) x Width (2)
- 6, 7,
- 8, 9,
- 10, 11,
-
- // Batch 1, Channel 0, Height (3) x Width (2)
- 12, 13,
- 14, 15,
- 16, 17,
-
- // Batch 1, Channel 1, Height (3) x Width (2)
- 18, 19,
- 20, 21,
- 22, 23
- }));
-
- std::vector<T> expectedOutputValues(
- QuantizedVector<T>(qScale,qOffset,
- {
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 1, 0,
- 0, 2, 3, 0,
- 0, 4, 5, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 6, 7, 0,
- 0, 8, 9, 0,
- 0, 10, 11, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 12, 13, 0,
- 0, 14, 15, 0,
- 0, 16, 17, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 18, 19, 0,
- 0, 20, 21, 0,
- 0, 22, 23, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0
- }));
+ std::vector<T> inputValues = armnnUtils::QuantizedVector<T>(
+ {
+ // Batch 0, Channel 0, Height (3) x Width (2)
+ 0, 1,
+ 2, 3,
+ 4, 5,
+
+ // Batch 0, Channel 1, Height (3) x Width (2)
+ 6, 7,
+ 8, 9,
+ 10, 11,
+
+ // Batch 1, Channel 0, Height (3) x Width (2)
+ 12, 13,
+ 14, 15,
+ 16, 17,
+
+ // Batch 1, Channel 1, Height (3) x Width (2)
+ 18, 19,
+ 20, 21,
+ 22, 23
+ },
+ qScale, qOffset);
+
+ std::vector<T> expectedOutputValues = armnnUtils::QuantizedVector<T>(
+ {
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 1, 0,
+ 0, 2, 3, 0,
+ 0, 4, 5, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 6, 7, 0,
+ 0, 8, 9, 0,
+ 0, 10, 11, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 12, 13, 0,
+ 0, 14, 15, 0,
+ 0, 16, 17, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 18, 19, 0,
+ 0, 20, 21, 0,
+ 0, 22, 23, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0
+ },
+ qScale, qOffset);
auto inputTensor = MakeTensor<T, 4>(inputTensorInfo, std::vector<T>(inputValues));
#include <backendsCommon/IBackendInternal.hpp>
#include <backendsCommon/WorkloadFactory.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
#include <backendsCommon/test/WorkloadTestUtils.hpp>
#include <test/TensorHelpers.hpp>
#include <DataLayoutIndexed.hpp>
#include <Permute.hpp>
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <TensorUtils.hpp>
#include <backendsCommon/WorkloadInfo.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
#include <backendsCommon/test/TensorCopyUtils.hpp>
#include <backendsCommon/test/WorkloadTestUtils.hpp>
namespace
{
+using namespace armnnUtils;
+
template<armnn::DataType ArmnnType, typename T = armnn::ResolveType<ArmnnType>>
LayerTestResult<T, 4> SimplePooling2dTestImpl(
armnn::IWorkloadFactory& workloadFactory,
inputData.insert(inputData.end(), singleChannelData.begin(), singleChannelData.end());
std::transform(singleChannelData.begin(), singleChannelData.end(), std::back_inserter(inputData), negator);
- auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, inputData));
+ auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(inputData, qScale, qOffset));
// These were calculated manually.
auto shape(GetTensorShapeAsArray<4>(outputTensorInfo));
if (forceNoPadding)
{
outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
8.0f, 8.0f, 8.0f,
9.0f, 7.0f, 9.0f,
9.0f, 9.0f, 9.0f,
0.0f, 0.0f, -3.0f,
-1.0f, 0.0f, 0.0f,
-1.0f, -1.0f, -1.0f
- }));
+ },
+ qScale, qOffset));
}
else
{
outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
0.0f, 8.0f, 8.0f, 8.0f, 8.0f, 8.0f,
0.0f, 9.0f, 7.0f, 9.0f, 9.0f, 3.0f,
0.0f, 8.0f, 9.0f, 9.0f, 9.0f, 9.0f,
0.0f, 0.0f, 0.0f, 0.0f,-3.0f, 0.0f,
0.0f,-1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f,-1.0f,-1.0f,-1.0f,-1.0f, 0.0f
- }));
+ },
+ qScale, qOffset));
}
return SimplePooling2dTestImpl<ArmnnType>(
}
std::vector<T> inputData(
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
1.0f, 2.0f, 5.0f, 6.0f,
3.0f, 4.0f, 7.0f, 8.0f,
9.0f, 10.0f, 13.0f, 14.0f,
19.0f, 20.0f, 23.0f, 24.0f,
25.0f, 26.0f, 29.0f, 30.0f,
27.0f, 28.0f, 31.0f, 32.0f,
- }));
+ },
+ qScale, qOffset));
std::vector<T> outputData(
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
4.0f, 8.0f,
12.0f, 16.0f,
20.0f, 24.0f,
28.0f, 32.0f,
- }));
+ },
+ qScale, qOffset));
const armnn::PermutationVector NCHWToNHWC = { 0, 3, 1, 2 };
if (dataLayout == armnn::DataLayout::NHWC)
}
std::vector<T> inputData(
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
2.0f, 2.0f, 6.0f, 6.0f,
4.0f, 4.0f, 8.0f, 8.0f,
10.0f, 12.0f, 14.0f, 16.0f,
20.0f, 18.0f, 22.0f, 24.0f,
26.0f, 28.0f, 0.0f, 0.0f,
26.0f, 28.0f, 0.0f, 0.0f,
- }));
+ },
+ qScale, qOffset));
std::vector<T> outputData(
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
3.0f, 7.0f,
11.0f, 15.0f,
19.0f, 23.0f,
27.0f, 0.0f,
- }));
+ },
+ qScale, qOffset));
const armnn::PermutationVector NCHWToNHWC = { 0, 3, 1, 2 };
if (dataLayout == armnn::DataLayout::NHWC)
armnn::TensorInfo outputTensorInfo = armnnUtils::GetTensorInfo(1, 2, 2, 2, dataLayout, ArmnnType);
std::vector<T> inputData(
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
1.0f, 7.0f, 5.0f, 5.0f,
1.0f, 7.0f, 5.0f, 5.0f,
3.0f, 3.0f, 1.0f, 1.0f,
1.0f, 7.0f, 2.0f, 0.0f,
0.0f, 2.0f, 1.0f, 1.0f,
0.0f, 0.0f, 1.0f, 1.0f,
- }));
+ },
+ qScale, qOffset));
std::vector<T> outputData(
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
5.0f, 5.0f,
3.0f, 1.0f,
5.0f, 1.0f,
1.0f, 1.0f,
- }));
+ },
+ qScale, qOffset));
const armnn::PermutationVector NCHWToNHWC = { 0, 3, 1, 2 };
if (dataLayout == armnn::DataLayout::NHWC)
armnn::TensorInfo inputTensorInfo({ 1, 1, 4, 4 }, ArmnnType);
auto input = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
2.0f, 1.0f, 5.0f, 2.0f,
1.0f, 2.0f, 2.0f, 1.0f,
5.0f, 4.0f, 1.0f, 5.0f,
2.0f, 1.0f, 5.0f, 2.0f,
- }));
+ },
+ qScale, qOffset));
armnn::TensorInfo outputTensorInfo({ 1, 1, 2, 2 }, ArmnnType);
auto outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
3.0f, 3.0f,
3.0f, 3.0f,
- }));
+ },
+ qScale, qOffset));
return SimplePooling2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, descriptor, qScale, qOffset, input, outputExpected);
armnn::TensorInfo inputTensorInfo({ 1, 1, 9, 9 }, ArmnnType);
auto input = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
2.0f, 1.0f, 5.0f, 2.0f, 1.0f, 5.0f, 2.0f, 1.0f, 5.0f,
1.0f, 2.0f, 2.0f, 1.0f, 2.0f, 2.0f, 1.0f, 2.0f, 2.0f,
5.0f, 4.0f, 1.0f, 5.0f, 4.0f, 1.0f, 5.0f, 4.0f, 1.0f,
2.0f, 1.0f, 5.0f, 2.0f, 1.0f, 5.0f, 2.0f, 1.0f, 5.0f,
1.0f, 2.0f, 2.0f, 1.0f, 2.0f, 2.0f, 1.0f, 2.0f, 2.0f,
5.0f, 4.0f, 1.0f, 5.0f, 4.0f, 1.0f, 5.0f, 4.0f, 1.0f,
- }));
+ },
+ qScale, qOffset));
armnn::TensorInfo outputTensorInfo({ 1, 1, 3, 3 }, ArmnnType);
auto outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
3.0f, 3.0f, 3.0f,
3.0f, 3.0f, 3.0f,
3.0f, 3.0f, 3.0f,
- }));
+ },
+ qScale, qOffset));
return SimplePooling2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, descriptor, qScale, qOffset, input, outputExpected);
armnn::TensorInfo inputTensorInfo({ 1, 1, 7, 7 }, ArmnnType);
auto input = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
2.0f, 1.0f, 5.0f, 0.0f, 2.0f, 1.0f, 5.0f,
1.0f, 2.0f, 2.0f, 0.0f, 1.0f, 2.0f, 2.0f,
5.0f, 4.0f, 1.0f, 0.0f, 5.0f, 4.0f, 1.0f,
2.0f, 1.0f, 5.0f, 0.0f, 2.0f, 1.0f, 5.0f,
1.0f, 2.0f, 2.0f, 0.0f, 1.0f, 2.0f, 2.0f,
5.0f, 4.0f, 1.0f, 0.0f, 5.0f, 4.0f, 1.0f,
- }));
+ },
+ qScale, qOffset));
armnn::TensorInfo outputTensorInfo({ 1, 1, 2, 2 }, ArmnnType);
auto outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
3.0f, 3.0f,
3.0f, 3.0f,
- }));
+ },
+ qScale, qOffset));
return SimplePooling2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, descriptor, qScale, qOffset, input, outputExpected);
armnn::TensorInfo inputTensorInfo({ 1, 1, 7, 7 }, ArmnnType);
auto input = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
1.0f, 0.0f, 2.0f, 0.0f, 3.0f, 0.0f, 4.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 5.0f, 0.0f, 6.0f, 0.0f, 7.0f, 0.0f,
0.0f, 5.0f, 0.0f, 2.0f, 0.0f, 1.0f, 1.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
- }));
+ },
+ qScale, qOffset));
armnn::TensorInfo outputTensorInfo({ 1, 1, 1, 1 }, ArmnnType);
auto outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
3.0f,
- }));
+ },
+ qScale, qOffset));
return SimplePooling2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, descriptor, qScale, qOffset, input, outputExpected);
armnn::TensorInfo inputTensorInfo({ 1, 1, 9, 9 }, ArmnnType);
auto input = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
2.0f, 1.0f, 5.0f, 2.0f, 1.0f, 5.0f, 2.0f, 1.0f, 5.0f,
1.0f, 2.0f, 2.0f, 1.0f, 2.0f, 2.0f, 1.0f, 2.0f, 2.0f,
5.0f, 4.0f, 1.0f, 5.0f, 4.0f, 1.0f, 5.0f, 4.0f, 1.0f,
2.0f, 1.0f, 5.0f, 2.0f, 1.0f, 5.0f, 2.0f, 1.0f, 5.0f,
1.0f, 2.0f, 2.0f, 1.0f, 2.0f, 2.0f, 1.0f, 2.0f, 2.0f,
5.0f, 4.0f, 1.0f, 5.0f, 4.0f, 1.0f, 5.0f, 4.0f, 1.0f,
- }));
+ },
+ qScale, qOffset));
armnn::TensorInfo outputTensorInfo({ 1, 1, 1, 1 }, ArmnnType);
auto outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
3.0f,
- }));
+ },
+ qScale, qOffset));
return SimplePooling2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, descriptor, qScale, qOffset, input, outputExpected);
// Construct input data.
auto input = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
1.0f, 3.0f, 4.0f,
- }));
+ },
+ qScale, qOffset));
// These were calculated manually.
auto outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
0.0f, 3.0f, 0.0f, 3.0f,
- }));
+ },
+ qScale, qOffset));
return SimplePooling2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, descriptor, qScale, qOffset, input, outputExpected);
outputTensorInfo.SetQuantizationOffset(qOffset);
}
- auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, inputData));
+ auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(inputData, qScale, qOffset));
auto outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- forceNoPadding ? QuantizedVector<T>(qScale, qOffset, expectedOutputDataNoPadding) :
- QuantizedVector<T>(qScale, qOffset, expectedOutputDataWithPadding));
+ forceNoPadding ? QuantizedVector<T>(expectedOutputDataNoPadding, qScale, qOffset) :
+ QuantizedVector<T>(expectedOutputDataWithPadding, qScale, qOffset));
return SimplePooling2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, descriptor, qScale, qOffset, input, outputExpected);
outputTensorInfo.SetQuantizationOffset(qOffset);
}
- auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, inputData));
+ auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(inputData, qScale, qOffset));
auto outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- forceNoPadding ? QuantizedVector<T>(qScale, qOffset, expectedOutputDataNoPadding) :
- QuantizedVector<T>(qScale, qOffset, expectedOutputDataWithPadding));
+ forceNoPadding ? QuantizedVector<T>(expectedOutputDataNoPadding, qScale, qOffset) :
+ QuantizedVector<T>(expectedOutputDataWithPadding, qScale, qOffset));
return SimplePooling2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, descriptor, qScale, qOffset, input, outputExpected);
}
auto input = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
-1.0f, -2.0f, 3.0f, 4.0f,
-1.0f, -2.0f, 3.0f, 4.0f,
1.0f, 2.0f, -3.0f, -4.0f,
1.0f, 2.0f, -3.0f, -4.0f,
- }));
+ },
+ qScale, qOffset));
auto outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
-1.0f, 3.0f, 4.0f,
1.0f, 3.0f, 4.0f,
1.0f, 2.0f, -4.0f,
- }));
+ },
+ qScale, qOffset));
return SimplePooling2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, descriptor, qScale, qOffset, input, outputExpected);
}
auto input = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
-1.0f, -2.0f, 3.0f, 4.0f,
-1.0f, -2.0f, 3.0f, 4.0f,
1.0f, 2.0f, -3.0f, -4.0f,
1.0f, 2.0f, -3.0f, -4.0f,
- }));
+ },
+ qScale, qOffset));
auto outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
-1.0f, 3.0f, 4.0f, 4.0f,
2.0f, 3.0f, 4.0f, 4.0f,
2.0f, 3.0f, 4.0f, 4.0f,
2.0f, 2.0f, 2.0f, -3.0f,
- }));
+ },
+ qScale, qOffset));
return SimplePooling2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, descriptor, qScale, qOffset, input, outputExpected);
}
auto input = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
12.0f, 20.0f, 32.0f, 40.0f,
12.0f, 20.0f, 32.0f, 40.0f,
12.0f, 20.0f, 32.0f, 40.0f,
12.0f, 20.0f, 32.0f, 40.0f,
- }));
+ },
+ qScale, qOffset));
auto outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
3.0f, 13.0f, 10.0f,
6.0f, 26.0f, 20.0f,
3.0f, 13.0f, 10.0f,
- }));
+ },
+ qScale, qOffset));
return SimplePooling2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, descriptor, qScale, qOffset, input, outputExpected);
}
auto input = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
1.0f, 2.0f, 3.0f, 4.0f,
1.0f, 2.0f, 3.0f, 4.0f,
1.0f, 2.0f, 3.0f, 4.0f,
1.0f, 2.0f, 3.0f, 4.0f,
- }));
+ },
+ qScale, qOffset));
auto outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
2.0f, 3.5f,
2.0f, 3.5f
- }));
+ },
+ qScale, qOffset));
return SimplePooling2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, descriptor, qScale, qOffset, input, outputExpected);
}
auto input = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
9.0f, 27.0f, 18.0f, 36.0f,
18.0f, 9.0f, 18.0f, 9.0f,
27.0f, 18.0f, 9.0f, 27.0f,
9.0f, 27.0f, 9.0f, 18.0f,
- }));
+ },
+ qScale, qOffset));
auto outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
7.0f, 11.0f, 13.0f, 9.0f,
12.0f, 17.0f, 19.0f, 13.0f,
12.0f, 16.0f, 16.0f, 10.0f,
9.0f, 11.0f, 12.0f, 7.0f,
- }));
+ },
+ qScale, qOffset));
return SimplePooling2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, descriptor, qScale, qOffset, input, outputExpected);
}
auto input = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
2.0f, 4.0f, 8.0f, 16.0f,
4.0f, 2.0f, 2.0f, 4.0f,
8.0f, 2.0f, 4.0f, 2.0f,
16.0f, 2.0f, 2.0f, 8.0f,
- }));
+ },
+ qScale, qOffset));
auto outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
1.0f, 4.4721f, 8.0f,
4.4721f, 2.6457f, 2.236f,
8.0f, 1.4142f, 4.0f,
- }));
+ },
+ qScale, qOffset));
return SimplePooling2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, descriptor, qScale, qOffset, input, outputExpected);
}
auto input = MakeTensor<T, 4>(inputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
1.0f, 2.0f, 3.0f, 4.0f,
1.0f, 2.0f, 3.0f, 4.0f,
1.0f, 2.0f, 3.0f, 4.0f,
1.0f, 2.0f, 3.0f, 4.0f,
- }));
+ },
+ qScale, qOffset));
auto outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(qScale, qOffset, {
+ QuantizedVector<T>({
1.0540f, 1.7638f, 2.5385f, 2.3570f,
1.2909f, 2.1602f, 3.1091f, 2.8867f,
1.2909f, 2.1602f, 3.1091f, 2.8867f,
1.0540f, 1.7638f, 2.5385f, 2.3570f,
- }));
+ },
+ qScale, qOffset));
return SimplePooling2dTestImpl<ArmnnType>(
workloadFactory, memoryManager, descriptor, qScale, qOffset, input, outputExpected);
#include "LayerTestResult.hpp"
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <armnn/ArmNN.hpp>
0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, -1.0f, -2.0f, 0.0f, -2.0f, -4.0f
};
- auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(),
- inputTensorInfo.GetQuantizationOffset(),
- inputData));
- auto alpha = MakeTensor<T, 4>(alphaTensorInfo, QuantizedVector<T>(alphaTensorInfo.GetQuantizationScale(),
- alphaTensorInfo.GetQuantizationOffset(),
- alphaData));
+ auto input = MakeTensor<T, 4>(inputTensorInfo,
+ armnnUtils::QuantizedVector<T>(inputData,
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset()));
+
+ auto alpha = MakeTensor<T, 4>(alphaTensorInfo,
+ armnnUtils::QuantizedVector<T>(alphaData,
+ alphaTensorInfo.GetQuantizationScale(),
+ alphaTensorInfo.GetQuantizationOffset()));
LayerTestResult<T, 4> result(outputTensorInfo);
- result.outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(),
- outputTensorInfo.GetQuantizationOffset(),
- outputExpectedData));
+ result.outputExpected =
+ MakeTensor<T, 4>(outputTensorInfo,
+ armnnUtils::QuantizedVector<T>(outputExpectedData,
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset()));
std::unique_ptr <armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr <armnn::ITensorHandle> alphaHandle = workloadFactory.CreateTensorHandle(alphaTensorInfo);
#include "LayerTestResult.hpp"
#include <Permute.hpp>
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <TensorUtils.hpp>
inputData = tmp;
}
- auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(),
- inputTensorInfo.GetQuantizationOffset(),
- inputData));
+ auto input = MakeTensor<T, 4>(inputTensorInfo,
+ armnnUtils::QuantizedVector<T>(inputData,
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset()));
LayerTestResult<T, 4> result(outputTensorInfo);
result.outputExpected = input;
outputData = tmp1;
}
- auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(),
- inputTensorInfo.GetQuantizationOffset(),
- inputData));
+ auto input = MakeTensor<T, 4>(inputTensorInfo,
+ armnnUtils::QuantizedVector<T>(inputData,
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset()));
LayerTestResult<T, 4> result(outputTensorInfo);
result.outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(),
- outputTensorInfo.GetQuantizationOffset(),
- outputData));
+ armnnUtils::QuantizedVector<T>(outputData,
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset()));
std::unique_ptr <armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr <armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
outputData = tmp1;
}
- auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(),
- inputTensorInfo.GetQuantizationOffset(),
- inputData));
+ auto input = MakeTensor<T, 4>(inputTensorInfo,
+ armnnUtils::QuantizedVector<T>(inputData,
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset()));
LayerTestResult<T, 4> result(outputTensorInfo);
result.outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(),
- outputTensorInfo.GetQuantizationOffset(),
- outputData));
+ armnnUtils::QuantizedVector<T>(outputData,
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset()));
std::unique_ptr <armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr <armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
outputData = tmp1;
}
- auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(),
- inputTensorInfo.GetQuantizationOffset(),
- inputData));
+ auto input = MakeTensor<T, 4>(inputTensorInfo,
+ armnnUtils::QuantizedVector<T>(inputData,
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset()));
LayerTestResult<T, 4> result(outputTensorInfo);
result.outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(),
- outputTensorInfo.GetQuantizationOffset(),
- outputData));
+ armnnUtils::QuantizedVector<T>(outputData,
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset()));
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
outputData = tmp1;
}
- auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(),
- inputTensorInfo.GetQuantizationOffset(),
- inputData));
+ auto input = MakeTensor<T, 4>(inputTensorInfo,
+ armnnUtils::QuantizedVector<T>(inputData,
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset()));
LayerTestResult<T, 4> result(outputTensorInfo);
result.outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(),
- outputTensorInfo.GetQuantizationOffset(),
- outputData));
+ armnnUtils::QuantizedVector<T>(outputData,
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset()));
std::unique_ptr <armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr <armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
inputData = tmp;
}
- auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(),
- inputTensorInfo.GetQuantizationOffset(),
- inputData));
+ auto input = MakeTensor<T, 4>(inputTensorInfo,
+ armnnUtils::QuantizedVector<T>(inputData,
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset()));
LayerTestResult<T, 4> result(outputTensorInfo);
result.outputExpected = input;
outputData = tmp1;
}
- auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(),
- inputTensorInfo.GetQuantizationOffset(),
- inputData));
+ auto input = MakeTensor<T, 4>(inputTensorInfo,
+ armnnUtils::QuantizedVector<T>(inputData,
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset()));
LayerTestResult<T, 4> result(outputTensorInfo);
result.outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(),
- outputTensorInfo.GetQuantizationOffset(),
- outputData));
+ armnnUtils::QuantizedVector<T>(outputData,
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset()));
std::unique_ptr <armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr <armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
outputData = tmp1;
}
- auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(),
- inputTensorInfo.GetQuantizationOffset(),
- inputData));
+ auto input = MakeTensor<T, 4>(inputTensorInfo,
+ armnnUtils::QuantizedVector<T>(inputData,
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset()));
LayerTestResult<T, 4> result(outputTensorInfo);
result.outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(),
- outputTensorInfo.GetQuantizationOffset(),
- outputData));
+ armnnUtils::QuantizedVector<T>(outputData,
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset()));
std::unique_ptr <armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr <armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
outputData = tmp1;
}
- auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(),
- inputTensorInfo.GetQuantizationOffset(),
- inputData));
+ auto input = MakeTensor<T, 4>(inputTensorInfo,
+ armnnUtils::QuantizedVector<T>(inputData,
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset()));
LayerTestResult<T, 4> result(outputTensorInfo);
result.outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(),
- outputTensorInfo.GetQuantizationOffset(),
- outputData));
+ armnnUtils::QuantizedVector<T>(outputData,
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset()));
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
outputData = tmp1;
}
- auto input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(inputTensorInfo.GetQuantizationScale(),
- inputTensorInfo.GetQuantizationOffset(),
- inputData));
+ auto input = MakeTensor<T, 4>(inputTensorInfo,
+ armnnUtils::QuantizedVector<T>(inputData,
+ inputTensorInfo.GetQuantizationScale(),
+ inputTensorInfo.GetQuantizationOffset()));
LayerTestResult<T, 4> result(outputTensorInfo);
result.outputExpected = MakeTensor<T, 4>(outputTensorInfo,
- QuantizedVector<T>(outputTensorInfo.GetQuantizationScale(),
- outputTensorInfo.GetQuantizationOffset(),
- outputData));
+ armnnUtils::QuantizedVector<T>(outputData,
+ outputTensorInfo.GetQuantizationScale(),
+ outputTensorInfo.GetQuantizationOffset()));
std::unique_ptr <armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr <armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
#include "SliceTestImpl.hpp"
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <armnn/ArmNN.hpp>
}
boost::multi_array<T, NumDims> input =
- MakeTensor<T, NumDims>(inputInfo, QuantizedVector<T>(qScale, qOffset, inputData));
+ MakeTensor<T, NumDims>(inputInfo, armnnUtils::QuantizedVector<T>(inputData, qScale, qOffset));
LayerTestResult<T, NumDims> result(outputInfo);
result.outputExpected =
- MakeTensor<T, NumDims>(outputInfo, QuantizedVector<T>(qScale, qOffset, expectedOutputData));
+ MakeTensor<T, NumDims>(outputInfo, armnnUtils::QuantizedVector<T>(expectedOutputData, qScale, qOffset));
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputInfo);
std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputInfo);
#include "SoftmaxTestImpl.hpp"
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <armnn/ArmNN.hpp>
#include <backendsCommon/CpuTensorHandle.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
#include <backendsCommon/test/TensorCopyUtils.hpp>
#include <backendsCommon/test/WorkloadTestUtils.hpp>
LayerTestResult<T, n> ret(outputTensorInfo);
// Each row is independently softmax'd.
- auto input = MakeTensor<T, n>(inputTensorInfo, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, inputData)));
+ auto input = MakeTensor<T, n>(inputTensorInfo, armnnUtils::QuantizedVector<T>(inputData, qScale, qOffset));
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
CopyDataFromITensorHandle(ret.output.origin(), outputHandle.get());
- std::vector<T> expectedOutput = std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, outputData));
+ std::vector<T> expectedOutput = armnnUtils::QuantizedVector<T>(outputData, qScale, qOffset);
ret.outputExpected = MakeTensor<T, n>(outputTensorInfo, expectedOutput);
return ret;
#include "SpaceToBatchNdTestImpl.hpp"
#include <Permute.hpp>
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <armnn/ArmNN.hpp>
outputTensorInfo.SetQuantizationOffset(qOffset);
}
- boost::multi_array<T, 4> input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, inputData));
+ boost::multi_array<T, 4> input = MakeTensor<T, 4>(inputTensorInfo,
+ armnnUtils::QuantizedVector<T>(inputData, qScale, qOffset));
LayerTestResult<T, 4> ret(outputTensorInfo);
- ret.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, outputExpectedData));
+ ret.outputExpected = MakeTensor<T, 4>(outputTensorInfo,
+ armnnUtils::QuantizedVector<T>(outputExpectedData, qScale, qOffset));
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
#include "SpaceToDepthTestImpl.hpp"
#include <Permute.hpp>
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <armnn/ArmNN.hpp>
outputTensorInfo.SetQuantizationOffset(qOffset);
}
- boost::multi_array<T, 4> input = MakeTensor<T, 4>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, inputData));
+ boost::multi_array<T, 4> input = MakeTensor<T, 4>(inputTensorInfo,
+ armnnUtils::QuantizedVector<T>(inputData, qScale, qOffset));
LayerTestResult<T, 4> ret(outputTensorInfo);
- ret.outputExpected = MakeTensor<T, 4>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, outputExpectedData));
+ ret.outputExpected = MakeTensor<T, 4>(outputTensorInfo,
+ armnnUtils::QuantizedVector<T>(outputExpectedData, qScale, qOffset));
std::unique_ptr<armnn::ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr<armnn::ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
#include "SplitterTestImpl.hpp"
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <armnn/ArmNN.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
#include <backendsCommon/test/TensorCopyUtils.hpp>
#include <backendsCommon/test/WorkloadTestUtils.hpp>
LayerTestResult<T,3> ret4(outputTensorInfo4);
auto input = MakeTensor<T, 3>(inputTensorInfo, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
+ armnnUtils::QuantizedVector<T>({
1.0f, 2.0f, 3.0f, 4.0f, 5.0f,
6.0f, 7.0f, 8.0f, 9.0f, 10.0f,
11.0f, 12.0f, 13.0f, 14.0f, 15.0f,
76.0f, 77.0f, 78.0f, 79.0f, 80.0f,
81.0f, 82.0f, 83.0f, 84.0f, 85.0f,
86.0f, 87.0f, 88.0f, 89.0f, 90.0f,
- })
+ },
+ qScale, qOffset)
));
// Channel 0 of the original input.
ret1.outputExpected = MakeTensor<T, 3>(outputTensorInfo1, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
+ armnnUtils::QuantizedVector<T>({
1.0f, 2.0f, 3.0f, 4.0f, 5.0f,
6.0f, 7.0f, 8.0f, 9.0f, 10.0f,
11.0f, 12.0f, 13.0f, 14.0f, 15.0f,
16.0f, 17.0f, 18.0f, 19.0f, 20.0f,
21.0f, 22.0f, 23.0f, 24.0f, 25.0f,
26.0f, 27.0f, 28.0f, 29.0f, 30.0f,
- })
+ },
+ qScale, qOffset)
));
// Channel 1 & 2 of the original input.
ret2.outputExpected = MakeTensor<T, 3>(outputTensorInfo2, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
+ armnnUtils::QuantizedVector<T>({
31.0f, 32.0f, 33.0f, 34.0f, 35.0f,
36.0f, 37.0f, 38.0f, 39.0f, 40.0f,
41.0f, 42.0f, 43.0f, 44.0f, 45.0f,
76.0f, 77.0f, 78.0f, 79.0f, 80.0f,
81.0f, 82.0f, 83.0f, 84.0f, 85.0f,
86.0f, 87.0f, 88.0f, 89.0f, 90.0f,
- })
+ },
+ qScale, qOffset)
));
// Channel 0 of return 2 (i.e. channels 1 and 2 of the original input).
ret3.outputExpected = MakeTensor<T, 3>(outputTensorInfo3, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
+ armnnUtils::QuantizedVector<T>({
31.0f, 32.0f, 33.0f, 34.0f, 35.0f,
36.0f, 37.0f, 38.0f, 39.0f, 40.0f,
41.0f, 42.0f, 43.0f, 44.0f, 45.0f,
46.0f, 47.0f, 48.0f, 49.0f, 50.0f,
51.0f, 52.0f, 53.0f, 54.0f, 55.0f,
56.0f, 57.0f, 58.0f, 59.0f, 60.0f,
- })
+ },
+ qScale, qOffset)
));
// Channel 1 of return 2.
ret4.outputExpected = MakeTensor<T, 3>(outputTensorInfo4, std::vector<T>(
- QuantizedVector<T>(qScale, qOffset, {
+ armnnUtils::QuantizedVector<T>({
61.0f, 62.0f, 63.0f, 64.0f, 65.0f,
66.0f, 67.0f, 68.0f, 69.0f, 70.0f,
71.0f, 72.0f, 73.0f, 74.0f, 75.0f,
76.0f, 77.0f, 78.0f, 79.0f, 80.0f,
81.0f, 82.0f, 83.0f, 84.0f, 85.0f,
86.0f, 87.0f, 88.0f, 89.0f, 90.0f,
- })
+ },
+ qScale, qOffset)
));
// NOTE: as a corollary of the splitting of x and y restriction the x and y values of the view origins
float qScale, int32_t qOffset)
{
const armnn::TensorInfo tensorInfo({ 3, 6, 5 }, ArmnnType, qScale, qOffset);
- auto input = MakeTensor<T, 3>(tensorInfo, QuantizedVector<T>(qScale, qOffset,
- {
- 1.0f, 2.0f, 3.0f, 4.0f, 5.0f,
- 6.0f, 7.0f, 8.0f, 9.0f, 10.0f,
- 11.0f, 12.0f, 13.0f, 14.0f, 15.0f,
- 16.0f, 17.0f, 18.0f, 19.0f, 20.0f,
- 21.0f, 22.0f, 23.0f, 24.0f, 25.0f,
- 26.0f, 27.0f, 28.0f, 29.0f, 30.0f,
-
- 31.0f, 32.0f, 33.0f, 34.0f, 35.0f,
- 36.0f, 37.0f, 38.0f, 39.0f, 40.0f,
- 41.0f, 42.0f, 43.0f, 44.0f, 45.0f,
- 46.0f, 47.0f, 48.0f, 49.0f, 50.0f,
- 51.0f, 52.0f, 53.0f, 54.0f, 55.0f,
- 56.0f, 57.0f, 58.0f, 59.0f, 60.0f,
-
- 61.0f, 62.0f, 63.0f, 64.0f, 65.0f,
- 66.0f, 67.0f, 68.0f, 69.0f, 70.0f,
- 71.0f, 72.0f, 73.0f, 74.0f, 75.0f,
- 76.0f, 77.0f, 78.0f, 79.0f, 80.0f,
- 81.0f, 82.0f, 83.0f, 84.0f, 85.0f,
- 86.0f, 87.0f, 88.0f, 89.0f, 90.0f,
- }));
+ auto input = MakeTensor<T, 3>(
+ tensorInfo,
+ armnnUtils::QuantizedVector<T>({
+ 1.0f, 2.0f, 3.0f, 4.0f, 5.0f,
+ 6.0f, 7.0f, 8.0f, 9.0f, 10.0f,
+ 11.0f, 12.0f, 13.0f, 14.0f, 15.0f,
+ 16.0f, 17.0f, 18.0f, 19.0f, 20.0f,
+ 21.0f, 22.0f, 23.0f, 24.0f, 25.0f,
+ 26.0f, 27.0f, 28.0f, 29.0f, 30.0f,
+
+ 31.0f, 32.0f, 33.0f, 34.0f, 35.0f,
+ 36.0f, 37.0f, 38.0f, 39.0f, 40.0f,
+ 41.0f, 42.0f, 43.0f, 44.0f, 45.0f,
+ 46.0f, 47.0f, 48.0f, 49.0f, 50.0f,
+ 51.0f, 52.0f, 53.0f, 54.0f, 55.0f,
+ 56.0f, 57.0f, 58.0f, 59.0f, 60.0f,
+
+ 61.0f, 62.0f, 63.0f, 64.0f, 65.0f,
+ 66.0f, 67.0f, 68.0f, 69.0f, 70.0f,
+ 71.0f, 72.0f, 73.0f, 74.0f, 75.0f,
+ 76.0f, 77.0f, 78.0f, 79.0f, 80.0f,
+ 81.0f, 82.0f, 83.0f, 84.0f, 85.0f,
+ 86.0f, 87.0f, 88.0f, 89.0f, 90.0f,
+ },
+ qScale, qOffset));
std::vector<unsigned int> origin = { 0, 0, 0 };
armnn::SplitterQueueDescriptor::ViewOrigin window(origin);
#include "StridedSliceTestImpl.hpp"
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <armnn/ArmNN.hpp>
}
boost::multi_array<T, InDim> input =
- MakeTensor<T, InDim>(inputTensorInfo, QuantizedVector<T>(qScale, qOffset, inputData));
+ MakeTensor<T, InDim>(inputTensorInfo, armnnUtils::QuantizedVector<T>(inputData, qScale, qOffset));
LayerTestResult<T, OutDim> ret(outputTensorInfo);
ret.outputExpected =
- MakeTensor<T, OutDim>(outputTensorInfo, QuantizedVector<T>(qScale, qOffset, outputExpectedData));
+ MakeTensor<T, OutDim>(outputTensorInfo, armnnUtils::QuantizedVector<T>(outputExpectedData, qScale, qOffset));
std::unique_ptr<armnn::ITensorHandle> inputHandle =
workloadFactory.CreateTensorHandle(inputTensorInfo);
#include <armnn/ArmNN.hpp>
#include <Permute.hpp>
+#include <QuantizeHelper.hpp>
#include <ResolveType.hpp>
#include <backendsCommon/CpuTensorHandle.hpp>
#include <backendsCommon/test/DataLayoutUtils.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
#include <backendsCommon/test/TensorCopyUtils.hpp>
#include <backendsCommon/test/WorkloadTestUtils.hpp>
TensorData<T> input =
{
inputInfo,
- QuantizedVector<T>(inputInfo.GetQuantizationScale(), inputInfo.GetQuantizationOffset(), inputData)
+ armnnUtils::QuantizedVector<T>(inputData, inputInfo.GetQuantizationScale(), inputInfo.GetQuantizationOffset())
};
// set up weights
TensorData<T> weights =
{
weightsInfo,
- QuantizedVector<T>(weightsInfo.GetQuantizationScale(), weightsInfo.GetQuantizationOffset(), weightsData)
+ armnnUtils::QuantizedVector<T>(weightsData,
+ weightsInfo.GetQuantizationScale(),
+ weightsInfo.GetQuantizationOffset())
};
// set up biases
TensorData<BT> biases =
{
biasesInfo,
- QuantizedVector<BT>(biasesInfo.GetQuantizationScale(), biasesInfo.GetQuantizationOffset(), biasesData)
+ armnnUtils::QuantizedVector<BT>(biasesData,
+ biasesInfo.GetQuantizationScale(),
+ biasesInfo.GetQuantizationOffset())
};
optionalBiases = Optional<TensorData<BT>>(biases);
LayerTestResult<T, 4> testResult(outputInfo);
testResult.output = MakeTensor<T, 4>(outputInfo, output.second);
testResult.outputExpected = MakeTensor<T, 4>(outputInfo,
- QuantizedVector<T>(outputInfo.GetQuantizationScale(),
- outputInfo.GetQuantizationOffset(),
- expectedOutputData));
+ armnnUtils::QuantizedVector<T>(expectedOutputData,
+ outputInfo.GetQuantizationScale(),
+ outputInfo.GetQuantizationOffset()));
return testResult;
}
#include <Graph.hpp>
#include <Optimizer.hpp>
#include <backendsCommon/CpuTensorHandle.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
#include <boost/core/ignore_unused.hpp>
#include <boost/test/unit_test.hpp>
const unsigned int height = 3;
const unsigned int channels = 2;
const unsigned int num = 1;
- int32_t qOffset = 0;
- float qScale = 0.f;
- TensorInfo inputTensorInfo({num, channels, height, width}, DataType::Float32);
+ TensorInfo inputTensorInfo( {num, channels, height, width}, DataType::Float32);
TensorInfo outputTensorInfo({num, channels, height, width}, DataType::Float32);
TensorInfo tensorInfo({channels}, DataType::Float32);
- // Set quantization parameters if the requested type is a quantized type.
- if(IsQuantizedType<float>())
- {
- inputTensorInfo.SetQuantizationScale(qScale);
- inputTensorInfo.SetQuantizationOffset(qOffset);
- outputTensorInfo.SetQuantizationScale(qScale);
- outputTensorInfo.SetQuantizationOffset(qOffset);
- tensorInfo.SetQuantizationScale(qScale);
- tensorInfo.SetQuantizationOffset(qOffset);
- }
-
auto input = MakeTensor<float, 4>(inputTensorInfo,
- QuantizedVector<float>(qScale, qOffset,
- {
- 1.f, 4.f,
- 4.f, 2.f,
- 1.f, 6.f,
-
- 1.f, 1.f,
- 4.f, 1.f,
- -2.f, 4.f
- }));
+ {
+ 1.f, 4.f,
+ 4.f, 2.f,
+ 1.f, 6.f,
+
+ 1.f, 1.f,
+ 4.f, 1.f,
+ -2.f, 4.f
+ });
+
// these values are per-channel of the input
- auto mean = MakeTensor<float, 1>(tensorInfo, QuantizedVector<float>(qScale, qOffset, {3, -2}));
- auto variance = MakeTensor<float, 1>(tensorInfo, QuantizedVector<float>(qScale, qOffset, {4, 9}));
- auto beta = MakeTensor<float, 1>(tensorInfo, QuantizedVector<float>(qScale, qOffset, {3, 2}));
- auto gamma = MakeTensor<float, 1>(tensorInfo, QuantizedVector<float>(qScale, qOffset, {2, 1}));
+ auto mean = MakeTensor<float, 1>(tensorInfo, { 3.f, -2.f });
+ auto variance = MakeTensor<float, 1>(tensorInfo, { 4.f, 9.f });
+ auto beta = MakeTensor<float, 1>(tensorInfo, { 3.f, 2.f });
+ auto gamma = MakeTensor<float, 1>(tensorInfo, { 2.f, 1.f });
std::unique_ptr<ITensorHandle> inputHandle = workloadFactory.CreateTensorHandle(inputTensorInfo);
std::unique_ptr<ITensorHandle> outputHandle = workloadFactory.CreateTensorHandle(outputTensorInfo);
#include <vector>
#include <armnn/TypesUtils.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
#include <boost/log/trivial.hpp>
#include <boost/numeric/conversion/cast.hpp>
}
} // anonymous namespace
-
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
+
#pragma once
+#include "InferenceTestImage.hpp"
#include "ObjectDetectionCommon.hpp"
-#include <memory>
-#include <string>
-#include <vector>
+#include <QuantizeHelper.hpp>
#include <armnn/TypesUtils.hpp>
-#include <backendsCommon/test/QuantizeHelper.hpp>
#include <boost/log/trivial.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <array>
+#include <memory>
#include <string>
-
-#include "InferenceTestImage.hpp"
+#include <vector>
namespace
{
// Get image data as a vector of floats
std::vector<float> floatImageData = GetImageDataAsNormalizedFloats(ImageChannelLayout::Rgb, image);
- imageData = QuantizedVector<uint8_t>(m_Scale, m_Offset, floatImageData);
+ imageData = armnnUtils::QuantizedVector<uint8_t>(floatImageData, m_Scale, m_Offset);
}
catch (const InferenceTestImageException& e)
{