aboutsummaryrefslogtreecommitdiff
path: root/src/graph/operations/CLSimpleOperations.cpp
diff options
context:
space:
mode:
authorAlex Gilday <alexander.gilday@arm.com>2018-02-15 11:07:18 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:47:40 +0000
commit8913d8d7bc83fdcb6c5dc9baca6bb369418de48b (patch)
treef9556fdf33af663ad9cfa7619093af334ef0af71 /src/graph/operations/CLSimpleOperations.cpp
parent15997879873b374ea297197fc4aafb15e38b938b (diff)
downloadComputeLibrary-8913d8d7bc83fdcb6c5dc9baca6bb369418de48b.tar.gz
COMPMID-915: Create ResNet50 example
ResidualLayer node (COMPMID-916) also created as required for the ResNet architecture. Change-Id: I4fb4d2e08a8d3ce206f96f7946f5afc3e244676a Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/121185 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'src/graph/operations/CLSimpleOperations.cpp')
-rw-r--r--src/graph/operations/CLSimpleOperations.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/graph/operations/CLSimpleOperations.cpp b/src/graph/operations/CLSimpleOperations.cpp
index 94e3fe15f7..fe56122009 100644
--- a/src/graph/operations/CLSimpleOperations.cpp
+++ b/src/graph/operations/CLSimpleOperations.cpp
@@ -66,6 +66,34 @@ REGISTER_SIMPLE_OPERATION(CLActivationLayerOperation, OPENCL, OperationType::Act
return std::move(activation);
}
+/* Arithmetic addition */
+REGISTER_SIMPLE_OPERATION(CLArithmeticAdditionOperation, OPENCL, OperationType::ArithmeticAddition)
+{
+ ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 2);
+ ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
+ ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
+ ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(1)) == nullptr);
+ ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
+
+ // Extract IO and info
+ auto *in1 = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
+ auto *in2 = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(1));
+ auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
+
+ auto addition = arm_compute::support::cpp14::make_unique<arm_compute::CLArithmeticAddition>();
+ addition->configure(in1, in2, out, ConvertPolicy::SATURATE);
+
+ // Log info
+ ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLArithmeticAddition"
+ << " Data Type: " << in1->info()->data_type()
+ << " Input 1 shape: " << in1->info()->tensor_shape()
+ << " Input 2 shape: " << in2->info()->tensor_shape()
+ << " Output shape: " << out->info()->tensor_shape()
+ << std::endl);
+
+ return std::move(addition);
+}
+
/* Batch Normalization Layer */
REGISTER_SIMPLE_OPERATION(CLBatchNormalizationLayerOperation, OPENCL, OperationType::BatchNormalizationLayer)
{
@@ -464,4 +492,4 @@ REGISTER_SIMPLE_OPERATION(CLSoftmaxLayerOperation, OPENCL, OperationType::Softma
<< std::endl);
return std::move(smx);
-} \ No newline at end of file
+}