diff options
author | thecha01 <theo.charalambous@arm.com> | 2020-07-28 17:45:07 +0100 |
---|---|---|
committer | Michele Di Giorgio <michele.digiorgio@arm.com> | 2020-08-25 10:17:55 +0000 |
commit | 96a14008af85725d067cdd8247023474581102ea (patch) | |
tree | a920ff3766133ec0012964d2fbfbdfa39aed1d5a /src/graph/nodes/EltwiseLayerNode.cpp | |
parent | 90251bc1e162925c4b85e8a2923af153af23da93 (diff) | |
download | ComputeLibrary-96a14008af85725d067cdd8247023474581102ea.tar.gz |
Fix EltwiseLayerNode and QuantizationLayerNode
- Fixed issue where EltwiseLayerNode would base output shape
off of first input tensor only
- Allow QuantizationLayerNode to use any quantized data type
if specified in constructor
Signed-off-by: thecha01 <theo.charalambous@arm.com>
Change-Id: Ib93470316799028cd573592a3d79943493eaa093
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3737
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Reviewed-by: Manuel Bottini <manuel.bottini@arm.com>
Diffstat (limited to 'src/graph/nodes/EltwiseLayerNode.cpp')
-rw-r--r-- | src/graph/nodes/EltwiseLayerNode.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/graph/nodes/EltwiseLayerNode.cpp b/src/graph/nodes/EltwiseLayerNode.cpp index 3149a9afef..4426e953ee 100644 --- a/src/graph/nodes/EltwiseLayerNode.cpp +++ b/src/graph/nodes/EltwiseLayerNode.cpp @@ -23,6 +23,7 @@ */ #include "arm_compute/graph/nodes/EltwiseLayerNode.h" +#include "arm_compute/core/TensorShape.h" #include "arm_compute/graph/Graph.h" #include "arm_compute/graph/INodeVisitor.h" @@ -69,7 +70,7 @@ void EltwiseLayerNode::set_fused_activation(ActivationLayerInfo fused_activation bool EltwiseLayerNode::forward_descriptors() { - if((input_id(0) != NullTensorID) && (output_id(0) != NullTensorID)) + if((input_id(0) != NullTensorID) && (input_id(1) != NullTensorID) && (output_id(0) != NullTensorID)) { Tensor *dst = output(0); ARM_COMPUTE_ERROR_ON(dst == nullptr); @@ -83,10 +84,18 @@ TensorDescriptor EltwiseLayerNode::configure_output(size_t idx) const { ARM_COMPUTE_UNUSED(idx); - const Tensor *src = input(0); - ARM_COMPUTE_ERROR_ON(src == nullptr); + const Tensor *src1 = input(0); + ARM_COMPUTE_ERROR_ON(src1 == nullptr); - auto output_info = src->desc(); + const Tensor *src2 = input(1); + ARM_COMPUTE_ERROR_ON(src2 == nullptr); + + auto output_info = src1->desc(); + + TensorShape out_shape = TensorShape::broadcast_shape(src1->desc().shape, src2->desc().shape); + ARM_COMPUTE_ERROR_ON_MSG(out_shape.total_size() == 0, "Inputs are not broadcast compatible"); + + output_info.set_shape(out_shape); if(!descriptor.out_quant_info.empty()) { |