diff options
author | Matteo Martincigh <matteo.martincigh@arm.com> | 2018-12-05 13:10:45 +0000 |
---|---|---|
committer | Matteo Martincigh <matteo.martincigh@arm.com> | 2018-12-05 13:56:16 +0000 |
commit | 075c7504b6d6ecd50fa61ca53ab1bcccc8865843 (patch) | |
tree | 6cf8009a0c63fc13927e8f8e11d5713683cf1d72 /src/armnnTfParser/TfParser.cpp | |
parent | 4631582a4c8b92917633d0af4ebcc8fff2abd04a (diff) | |
download | armnn-075c7504b6d6ecd50fa61ca53ab1bcccc8865843.tar.gz |
IVGCVSW-2267 Remove the input swizzling from ParseFusedBatchNorm
* Removed the input swizzling when the data layout is NHWC
* Split the unit test into NHWC and NCHW cases
Change-Id: I6b9fef70bc4ba5e01d14cbfaea3c842a289b0a0e
Diffstat (limited to 'src/armnnTfParser/TfParser.cpp')
-rw-r--r-- | src/armnnTfParser/TfParser.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/armnnTfParser/TfParser.cpp b/src/armnnTfParser/TfParser.cpp index b40b05409a..73bdb656b5 100644 --- a/src/armnnTfParser/TfParser.cpp +++ b/src/armnnTfParser/TfParser.cpp @@ -1421,9 +1421,14 @@ ParsedTfOperationPtr TfParser::ParseFusedBatchNorm(const tensorflow::NodeDef& no ParsedConstTfOperation<float>* varianceNode = boost::polymorphic_downcast<ParsedConstTfOperation<float> *>(inputs[4].m_IndexedValue); + const std::string dataFormat = ReadMandatoryNodeStringAttribute(nodeDef, "data_format"); + + CHECK_DATA_FORMAT(nodeDef, dataFormat, "FusedBatchNorm"); + // The descriptor only has the epsilon attribute. BatchNormalizationDescriptor desc; desc.m_Eps = ReadMandatoryNodeFloatAttribute(nodeDef, "epsilon"); + desc.m_DataLayout = dataFormat == "NHWC" ? DataLayout::NHWC : DataLayout::NCHW; // Data for the parsed tensor args (scale, offset, mean, variance) must be stored // locally until the layer is added. @@ -1448,19 +1453,8 @@ ParsedTfOperationPtr TfParser::ParseFusedBatchNorm(const tensorflow::NodeDef& no IOutputSlot& inputSlot = inputs[0].m_IndexedValue->ResolveArmnnOutputSlot(inputs[0].m_Index); - const std::string dataFormat = ReadMandatoryNodeStringAttribute(nodeDef, "data_format"); - - if (dataFormat == "NHWC") - { - const TensorInfo outputTensorInfo = armnnUtils::Permuted(inputSlot.GetTensorInfo(), NHWCToArmNN); - layer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo); - layer = SwizzleInDeswizzleOut(*m_Network, inputSlot, *layer, nodeDef.name()); - } - else - { - layer->GetOutputSlot(0).SetTensorInfo(inputSlot.GetTensorInfo()); - inputSlot.Connect(layer->GetInputSlot(0)); - } + layer->GetOutputSlot(0).SetTensorInfo(inputSlot.GetTensorInfo()); + inputSlot.Connect(layer->GetInputSlot(0)); return std::make_unique<SingleLayerParsedTfOperation>(this, nodeDef, layer); } |