From f8c4749a463106696ab99b6400b92a858a169a19 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Tue, 4 Feb 2020 17:39:59 +0000 Subject: COMPMID-3083: Add graph support for PRelu Change-Id: I48492f8c48b818b563bba1e0b48831ac5cdf1420 Signed-off-by: Georgios Pinitas Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/2685 Comments-Addressed: Arm Jenkins Reviewed-by: Michele Di Giorgio Tested-by: Arm Jenkins --- arm_compute/graph/backends/FunctionHelpers.h | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'arm_compute/graph/backends/FunctionHelpers.h') diff --git a/arm_compute/graph/backends/FunctionHelpers.h b/arm_compute/graph/backends/FunctionHelpers.h index 65a3e15a66..9f352edb9a 100644 --- a/arm_compute/graph/backends/FunctionHelpers.h +++ b/arm_compute/graph/backends/FunctionHelpers.h @@ -1149,6 +1149,44 @@ std::unique_ptr create_pooling_layer(PoolingLayerNode &node) return std::move(func); } +/** Create a backend PRelu layer function + * + * @tparam PReluFunction Backend PRelu function + * @tparam TargetInfo Target-specific information + * + * @param[in] node Node to create the backend function for + * + * @return Backend PRelu layer function + */ +template +std::unique_ptr create_prelu_layer(PReluLayerNode &node) +{ + validate_node(node, 2 /* expected inputs */, 1 /* expected outputs */); + + // Extract IO and info + typename TargetInfo::TensorType *input = get_backing_tensor(node.input(0)); + typename TargetInfo::TensorType *alpha = get_backing_tensor(node.input(1)); + typename TargetInfo::TensorType *output = get_backing_tensor(node.output(0)); + ARM_COMPUTE_ERROR_ON(input == nullptr || alpha == nullptr); + ARM_COMPUTE_ERROR_ON(output == nullptr); + + // Create and configure function + auto func = support::cpp14::make_unique(); + func->configure(input, alpha, output); + + // Log info + ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " + << node.name() + << " Type: " << node.type() + << " Target: " << TargetInfo::TargetType + << " Data Type: " << input->info()->data_type() + << " Input shape: " << input->info()->tensor_shape() + << " Output shape: " << output->info()->tensor_shape() + << std::endl); + + return std::move(func); +} + /** Create a backend print layer function * * @tparam TargetInfo Target-specific information -- cgit v1.2.1