aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNattapat Chaimanowong <nattapat.chaimanowong@arm.com>2019-02-15 16:46:24 +0000
committerAron Virginas-Tar <aron.virginas-tar@arm.com>2019-02-20 09:40:59 +0000
commitfab64f09f49280ce7e57837c8bc99de31089512c (patch)
tree2279eafa72076e9ed66fe6aa334a008496cbf48b
parent30211047e0c35ae8650ec939d569ec9e302b616b (diff)
downloadarmnn-fab64f09f49280ce7e57837c8bc99de31089512c.tar.gz
IVGCVSW-2730 Fix bug in TfParser setting incorrect output shape for Addition Layer
*Output shape was incorrectly set for case when the 2 inputs have same number of dimensions and each dimension has different (but broadcast compatible) size Change-Id: Ia617442b2b7f962c33792b94035236d26de70558 Signed-off-by: Nattapat Chaimanowong <nattapat.chaimanowong@arm.com>
-rwxr-xr-xsrc/armnnTfParser/TfParser.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/armnnTfParser/TfParser.cpp b/src/armnnTfParser/TfParser.cpp
index b5fe6be075..0410460059 100755
--- a/src/armnnTfParser/TfParser.cpp
+++ b/src/armnnTfParser/TfParser.cpp
@@ -2910,7 +2910,25 @@ ParsedTfOperationPtr TfParser::AddAdditionLayer(const tensorflow::NodeDef& nodeD
input0Slot->Connect(layer->GetInputSlot(0));
input1Slot->Connect(layer->GetInputSlot(1));
- if (input0Info.GetNumDimensions() == 1 && isBiasAdd == false)
+ if (input0Info.GetNumDimensions() == input1Info.GetNumDimensions())
+ {
+ const TensorShape& input0Shape = input0Info.GetShape();
+ const TensorShape& input1Shape = input1Info.GetShape();
+
+ std::vector<unsigned int> outputShape;
+ outputShape.reserve(input0Shape.GetNumDimensions());
+ TensorInfo outputInfo(input0Info);
+
+ for (unsigned int i = 0; i < input0Shape.GetNumDimensions(); i++)
+ {
+ outputShape.push_back(std::max(input0Shape[i], input1Shape[i]));
+ }
+
+ outputInfo.SetShape(TensorShape(input0Shape.GetNumDimensions(), outputShape.data()));
+
+ layer->GetOutputSlot(0).SetTensorInfo(outputInfo);
+ }
+ else if (input0Info.GetNumDimensions() == 1 && isBiasAdd == false)
{
layer->GetOutputSlot(0).SetTensorInfo(input1Slot->GetTensorInfo());
}