diff options
author | Jan Eilers <jan.eilers@arm.com> | 2021-04-06 17:29:03 +0100 |
---|---|---|
committer | Jan Eilers <jan.eilers@arm.com> | 2021-04-21 11:18:29 +0000 |
commit | 7612bd6cc385dfbf54f831a6349f3a9363c6d0a2 (patch) | |
tree | be63c7085e8802285473d10da8a7258a2600a378 /src/armnnTfLiteParser/TfLiteParser.cpp | |
parent | 4af561666b0ce5c12164447a5f7eb9722abb85f8 (diff) | |
download | armnn-7612bd6cc385dfbf54f831a6349f3a9363c6d0a2.tar.gz |
IVGCVSW-5842 Remove cross-wiring in depthwise
* Reading tensor infos won't allow a permutation vector anymore.
The permutation only changed the quantization dimension not the
shape and was therefore misleading
* The permutation of the full tensor info is now performed in
armnnUtils::Permuted
* Changed TfLite Parser depthwise parsing function
* Added unit tests to TfLite Parser with more random data
* Changed TfLite Delegate depthwise parsing function
* Added unit test to the delegate with per channel quantization
!android-nn-driver:5412
Signed-off-by: Jan Eilers <jan.eilers@arm.com>
Change-Id: I1f985ee69547bcaf16a72201e00a6b6fe1ef9a97
Diffstat (limited to 'src/armnnTfLiteParser/TfLiteParser.cpp')
-rw-r--r-- | src/armnnTfLiteParser/TfLiteParser.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/armnnTfLiteParser/TfLiteParser.cpp b/src/armnnTfLiteParser/TfLiteParser.cpp index a68839c20e..9b1fa9075c 100644 --- a/src/armnnTfLiteParser/TfLiteParser.cpp +++ b/src/armnnTfLiteParser/TfLiteParser.cpp @@ -359,7 +359,6 @@ void CalcPadding(uint32_t inputSize, armnn::TensorInfo ToTensorInfo(TfLiteParserImpl::TensorRawPtr tensorPtr, const std::vector<unsigned int>& shapes, - const armnn::PermutationVector& dimensionMappings = {0, 1, 2, 3}, const bool outputTensor = false) { armnn::DataType type; @@ -472,8 +471,7 @@ armnn::TensorInfo ToTensorInfo(TfLiteParserImpl::TensorRawPtr tensorPtr, armnn::TensorInfo result(tensorShape, type, quantizationScales, - dimensionMappings[armnn::numeric_cast<unsigned int>( - tensorPtr->quantization->quantized_dimension)]); + armnn::numeric_cast<unsigned int>(tensorPtr->quantization->quantized_dimension)); return result; } } @@ -493,19 +491,17 @@ armnn::TensorInfo ToTensorInfo(TfLiteParserImpl::TensorRawPtr tensorPtr, } } -armnn::TensorInfo ToTensorInfo(TfLiteParserImpl::TensorRawPtr tensorPtr, - const armnn::PermutationVector& dimensionMappings = {0, 1, 2, 3}) +armnn::TensorInfo ToTensorInfo(TfLiteParserImpl::TensorRawPtr tensorPtr) { auto const & dimensions = AsUnsignedVector(tensorPtr->shape); - return ToTensorInfo(tensorPtr, dimensions, dimensionMappings); + return ToTensorInfo(tensorPtr, dimensions); } armnn::TensorInfo ToTensorInfo(TfLiteParserImpl::TensorRawPtr tensorPtr, const bool outputTensor) { auto const & dimensions = AsUnsignedVector(tensorPtr->shape); - const armnn::PermutationVector& dimensionMappings = {0, 1, 2, 3}; - return ToTensorInfo(tensorPtr, dimensions, dimensionMappings, outputTensor); + return ToTensorInfo(tensorPtr, dimensions, outputTensor); } template<typename T> @@ -1013,7 +1009,7 @@ void TfLiteParserImpl::ParseDepthwiseConv2D(size_t subgraphIndex, size_t operato PermutationVector permutationVector{ 2, 3, 1, 0 }; // [H, W, I, M] -> [M, I, H, W] armnn::TensorInfo inputTensorInfo = ToTensorInfo(inputs[0]); - armnn::TensorInfo filterTensorInfo = ToTensorInfo(inputs[1], permutationVector); + armnn::TensorInfo filterTensorInfo = ToTensorInfo(inputs[1]); // Assuming input is NHWC unsigned int inputHeight = inputTensorInfo.GetShape()[1]; |