From bf19d2a95462fffdb7288a2289056dd443ca4275 Mon Sep 17 00:00:00 2001 From: Matteo Martincigh Date: Fri, 29 Nov 2019 11:46:50 +0000 Subject: IVGCVSW-4209 Remove the Half.hpp header usage from the driver * Removed the inclusion of the Half.hpp header from the Android NN Driver, as it's a private header not part of the now public armnnUtils API * Refactored the code not to use that header Signed-off-by: Matteo Martincigh Change-Id: I0feeb86ccb31e016395e623029974f599a174149 --- Utils.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/Utils.cpp b/Utils.cpp index ee46aea0..a5a6ef0e 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -9,8 +9,6 @@ #include -#include - #include #include @@ -25,14 +23,12 @@ const armnn::PermutationVector g_DontPermute{}; namespace { -template void SwizzleAndroidNn4dTensorToArmNn(const armnn::TensorShape& inTensorShape, const void* input, - void* output, const armnn::PermutationVector& mappings) + void* output, size_t dataTypeSize, const armnn::PermutationVector& mappings) { - const auto inputData = static_cast(input); - const auto outputData = static_cast(output); + assert(inTensorShape.GetNumDimensions() == 4U); - armnnUtils::Permute(armnnUtils::Permuted(inTensorShape, mappings), mappings, inputData, outputData, sizeof(T)); + armnnUtils::Permute(armnnUtils::Permuted(inTensorShape, mappings), mappings, input, output, dataTypeSize); } } // anonymous namespace @@ -42,19 +38,14 @@ void SwizzleAndroidNn4dTensorToArmNn(const armnn::TensorInfo& tensor, const void { assert(tensor.GetNumDimensions() == 4U); - switch(tensor.GetDataType()) + armnn::DataType dataType = tensor.GetDataType(); + switch (dataType) { case armnn::DataType::Float16: - SwizzleAndroidNn4dTensorToArmNn(tensor.GetShape(), input, output, mappings); - break; case armnn::DataType::Float32: - SwizzleAndroidNn4dTensorToArmNn(tensor.GetShape(), input, output, mappings); - break; case armnn::DataType::QuantisedAsymm8: - SwizzleAndroidNn4dTensorToArmNn(tensor.GetShape(), input, output, mappings); - break; case armnn::DataType::QuantizedSymm8PerAxis: - SwizzleAndroidNn4dTensorToArmNn(tensor.GetShape(), input, output, mappings); + SwizzleAndroidNn4dTensorToArmNn(tensor.GetShape(), input, output, armnn::GetDataTypeSize(dataType), mappings); break; default: ALOGW("Unknown armnn::DataType for swizzling"); -- cgit v1.2.1