From 797b76b1aef38ea3be6f68ae2bf323048e9beff8 Mon Sep 17 00:00:00 2001 From: Sang-Hoon Park Date: Wed, 11 Mar 2020 23:21:14 +0000 Subject: COMPMID-3221: Add EltwiseLayerDescriptor A new descriptor struct for EltwiseLayerNode is added to have better extendability. Change-Id: I3d0a4b3cec1f2425f39157cee6b5c344336412a3 Signed-off-by: Sang-Hoon Park Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/2876 Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio --- src/graph/GraphBuilder.cpp | 2 +- src/graph/nodes/EltwiseLayerNode.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/graph') diff --git a/src/graph/GraphBuilder.cpp b/src/graph/GraphBuilder.cpp index 97ade9362d..e429817d50 100644 --- a/src/graph/GraphBuilder.cpp +++ b/src/graph/GraphBuilder.cpp @@ -438,7 +438,7 @@ NodeID GraphBuilder::add_elementwise_node(Graph &g, NodeParams params, NodeIdxPa check_nodeidx_pair(input0, g); check_nodeidx_pair(input1, g); - NodeID nid = g.add_node(operation); + NodeID nid = g.add_node(descriptors::EltwiseLayerDescriptor{ operation }); g.add_connection(input0.node_id, input0.index, nid, 0); g.add_connection(input1.node_id, input1.index, nid, 1); diff --git a/src/graph/nodes/EltwiseLayerNode.cpp b/src/graph/nodes/EltwiseLayerNode.cpp index 7970bad5f7..a83a5fb3b2 100644 --- a/src/graph/nodes/EltwiseLayerNode.cpp +++ b/src/graph/nodes/EltwiseLayerNode.cpp @@ -30,8 +30,8 @@ namespace arm_compute { namespace graph { -EltwiseLayerNode::EltwiseLayerNode(EltwiseOperation op, QuantizationInfo out_quant_info, ConvertPolicy c_policy, RoundingPolicy r_policy) - : _op(op), _out_quant_info(out_quant_info), _convert_policy(c_policy), _rounding_policy(r_policy) +EltwiseLayerNode::EltwiseLayerNode(const descriptors::EltwiseLayerDescriptor &descriptor) + : descriptor(descriptor) { _input_edges.resize(2, EmptyEdgeID); _outputs.resize(1, NullTensorID); @@ -39,17 +39,17 @@ EltwiseLayerNode::EltwiseLayerNode(EltwiseOperation op, QuantizationInfo out_qua EltwiseOperation EltwiseLayerNode::eltwise_operation() const { - return _op; + return descriptor.op; } ConvertPolicy EltwiseLayerNode::convert_policy() const { - return _convert_policy; + return descriptor.c_policy; } RoundingPolicy EltwiseLayerNode::rounding_policy() const { - return _rounding_policy; + return descriptor.r_policy; } bool EltwiseLayerNode::forward_descriptors() @@ -66,16 +66,16 @@ bool EltwiseLayerNode::forward_descriptors() TensorDescriptor EltwiseLayerNode::configure_output(size_t idx) const { - ARM_COMPUTE_UNUSED(idx, _op, _convert_policy, _rounding_policy); + ARM_COMPUTE_UNUSED(idx); const Tensor *src = input(0); ARM_COMPUTE_ERROR_ON(src == nullptr); auto output_info = src->desc(); - if(!_out_quant_info.empty()) + if(!descriptor.out_quant_info.empty()) { - output_info.set_quantization_info(_out_quant_info); + output_info.set_quantization_info(descriptor.out_quant_info); } return output_info; -- cgit v1.2.1