From e8f05da5fb919aa209e1bf0e5c70dd15fff84b7f Mon Sep 17 00:00:00 2001 From: thecha01 Date: Mon, 24 Aug 2020 17:21:41 +0100 Subject: Add ArgMinMax layer node to Graph API Change-Id: I2ccb2c65edd2932b76e905af3d747324b65c2f7f Signed-off-by: thecha01 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3910 Comments-Addressed: Arm Jenkins Reviewed-by: Michele Di Giorgio Tested-by: Arm Jenkins --- arm_compute/graph/backends/FunctionHelpers.h | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 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 5b0e7d174c..05695fb797 100644 --- a/arm_compute/graph/backends/FunctionHelpers.h +++ b/arm_compute/graph/backends/FunctionHelpers.h @@ -131,6 +131,43 @@ std::unique_ptr create_activation_layer(ActivationLayerNode &node) return RETURN_UNIQUE_PTR(func); } +/** Creates a backend argminmax layer function + * + * @tparam ArgMinMaxLayerFunction Backend activation function + * @tparam TargetInfo Target-specific information + * + * @param[in] node Node to create the backend function for + * + * @return Backend argminmax layer function + */ +template +std::unique_ptr create_arg_min_max_layer(ArgMinMaxLayerNode &node) +{ + validate_node(node, 1 /* expected inputs */, 1 /* expected outputs */); + + // Extract IO and info + typename TargetInfo::TensorType *input = get_backing_tensor(node.input(0)); + typename TargetInfo::TensorType *output = get_backing_tensor(node.output(0)); + const ReductionOperation op = node.reduction_operation(); + unsigned int axis = node.axis(); + + // Create function + auto func = support::cpp14::make_unique(); + func->configure(input, axis, output, op); + + ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " + << node.name() + << " Type: " << node.type() + << " Target: " << TargetInfo::TargetType + << " Data Type: " << input->info()->data_type() + << " Shape: " << input->info()->tensor_shape() + << " Reduction Operation: " << op + << " axis: " << axis + << std::endl); + + return RETURN_UNIQUE_PTR(func); +} + /** Create a backend batch normalization layer function * * @tparam BatchNormalizationLayerFunction Backend batch normalization function -- cgit v1.2.1