From 1856ff7ebb29e04c3549b74d7ced336111cbf05e Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Fri, 7 Feb 2020 13:46:45 +0000 Subject: COMPMID-3097 Fuse activation with fully connected layer CL Change-Id: I447030e69b9e565f2f81529a41af8c5e7ece7ecf Signed-off-by: Giorgio Arena Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/2702 Comments-Addressed: Arm Jenkins Reviewed-by: Georgios Pinitas Tested-by: Arm Jenkins --- src/graph/mutators/NodeFusionMutator.cpp | 7 ++++++- src/graph/nodes/FullyConnectedLayer.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/graph') diff --git a/src/graph/mutators/NodeFusionMutator.cpp b/src/graph/mutators/NodeFusionMutator.cpp index b7f081dc42..151a8bfa03 100644 --- a/src/graph/mutators/NodeFusionMutator.cpp +++ b/src/graph/mutators/NodeFusionMutator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 ARM Limited. + * Copyright (c) 2018-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -301,6 +301,10 @@ void NodeFusionMutator::mutate(Graph &g) { return true; }; + auto cl_target_prec = [](INode & n) + { + return n.assigned_target() == Target::CL; + }; auto qs8_prec = [&g](INode & n) { ARM_COMPUTE_ERROR_ON(n.output(0) == nullptr); @@ -318,6 +322,7 @@ void NodeFusionMutator::mutate(Graph &g) detail::fuse_layer(g, empty_prec, detail::fuse_node_with_activation, supported_fused_activations); detail::fuse_layer(g, empty_prec, detail::fuse_node_with_activation, supported_fused_activations); detail::fuse_layer(g, qs8_prec, detail::fuse_node_with_activation, supported_fused_activations); + detail::fuse_layer(g, cl_target_prec, detail::fuse_node_with_activation, supported_fused_activations); detail::fuse_layer(g, empty_prec, detail::fuse_convolution_with_batch_normalization); detail::fuse_layer(g, empty_prec, detail::fuse_depthwise_convolution_with_batch_normalization); } diff --git a/src/graph/nodes/FullyConnectedLayer.cpp b/src/graph/nodes/FullyConnectedLayer.cpp index 80fce7b8a1..34c432a1ce 100644 --- a/src/graph/nodes/FullyConnectedLayer.cpp +++ b/src/graph/nodes/FullyConnectedLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 ARM Limited. + * Copyright (c) 2018-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -38,6 +38,11 @@ FullyConnectedLayerNode::FullyConnectedLayerNode(unsigned int num_outputs, Quant _outputs.resize(1, NullTensorID); } +void FullyConnectedLayerNode::set_fused_activation(ActivationLayerInfo fused_activation) +{ + _info.activation_info = fused_activation; +} + TensorDescriptor FullyConnectedLayerNode::compute_weights_descriptor(const TensorDescriptor &input_descriptor, unsigned int num_outputs, FullyConnectedLayerInfo fc_info, -- cgit v1.2.1