From 7e5d187c612fcc715ea3f7f0c900eb13af75a660 Mon Sep 17 00:00:00 2001 From: Kevin Petit Date: Thu, 25 Jan 2024 14:53:20 +0000 Subject: Add missing pseudocode for CONST, CUSTOM, ERF, and IDENTITY operators Signed-off-by: Kevin Petit Change-Id: Icb824233e5be84ac0eb693459b65441e9ae6c545 --- chapters/activation_funcs.adoc | 5 +++++ chapters/custom.adoc | 4 ++-- chapters/data_nodes.adoc | 9 +++++++++ pseudocode/operators/CONST.tosac | 10 ++++++++++ pseudocode/operators/CUSTOM.tosac | 11 +++++++++++ pseudocode/operators/ERF.tosac | 14 ++++++++++++++ pseudocode/operators/IDENTITY.tosac | 10 ++++++++++ 7 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 pseudocode/operators/CONST.tosac create mode 100644 pseudocode/operators/CUSTOM.tosac create mode 100644 pseudocode/operators/ERF.tosac create mode 100644 pseudocode/operators/IDENTITY.tosac diff --git a/chapters/activation_funcs.adoc b/chapters/activation_funcs.adoc index 1be3168..a64d7d0 100644 --- a/chapters/activation_funcs.adoc +++ b/chapters/activation_funcs.adoc @@ -43,6 +43,11 @@ include::{pseudocode}/operators/tables/ERF.tosac[lines=10..-1] include::{generated}/operators/ERF.adoc[] +[source,c++] +---- +include::{pseudocode}/operators/ERF.tosac[lines=10..-1] +---- + ==== SIGMOID Applies the sigmoid logistic function to each element of the input tensor. diff --git a/chapters/custom.adoc b/chapters/custom.adoc index 76f3eb4..6d7eb49 100644 --- a/chapters/custom.adoc +++ b/chapters/custom.adoc @@ -22,5 +22,5 @@ include::{generated}/operators/CUSTOM.adoc[] [source,c++] ---- -// Implementation defined behavior ----- \ No newline at end of file +include::{pseudocode}/operators/CUSTOM.tosac[lines=10..-1] +---- diff --git a/chapters/data_nodes.adoc b/chapters/data_nodes.adoc index 65e6b75..f0fc149 100644 --- a/chapters/data_nodes.adoc +++ b/chapters/data_nodes.adoc @@ -15,9 +15,18 @@ A node containing constant data for use as the input to an operation. May hold d include::{generated}/operators/CONST.adoc[] +[source,c++] +---- +include::{pseudocode}/operators/CONST.tosac[lines=10..-1] +---- + ==== IDENTITY Returns a tensor with the same shape, type, and contents as the input. include::{generated}/operators/IDENTITY.adoc[] +[source,c++] +---- +include::{pseudocode}/operators/IDENTITY.tosac[lines=10..-1] +---- diff --git a/pseudocode/operators/CONST.tosac b/pseudocode/operators/CONST.tosac new file mode 100644 index 0000000..d14ead2 --- /dev/null +++ b/pseudocode/operators/CONST.tosac @@ -0,0 +1,10 @@ +// +// This confidential and proprietary software may be used only as +// authorised by a licensing agreement from ARM Limited +// (C) COPYRIGHT 2024 ARM Limited +// ALL RIGHTS RESERVED +// The entire notice above must be reproduced on all authorised +// copies and copies may only be made to the extent permitted +// by a licensing agreement from ARM Limited. + +output = values; diff --git a/pseudocode/operators/CUSTOM.tosac b/pseudocode/operators/CUSTOM.tosac new file mode 100644 index 0000000..6a4f224 --- /dev/null +++ b/pseudocode/operators/CUSTOM.tosac @@ -0,0 +1,11 @@ +// +// This confidential and proprietary software may be used only as +// authorised by a licensing agreement from ARM Limited +// (C) COPYRIGHT 2020-2024 ARM Limited +// ALL RIGHTS RESERVED +// The entire notice above must be reproduced on all authorised +// copies and copies may only be made to the extent permitted +// by a licensing agreement from ARM Limited. + + +// Implementation defined behavior diff --git a/pseudocode/operators/ERF.tosac b/pseudocode/operators/ERF.tosac new file mode 100644 index 0000000..e226a52 --- /dev/null +++ b/pseudocode/operators/ERF.tosac @@ -0,0 +1,14 @@ +// +// This confidential and proprietary software may be used only as +// authorised by a licensing agreement from ARM Limited +// (C) COPYRIGHT 2020-2024 ARM Limited +// ALL RIGHTS RESERVED +// The entire notice above must be reproduced on all authorised +// copies and copies may only be made to the extent permitted +// by a licensing agreement from ARM Limited. + +for_each(index in shape) { + in_out_t value1 = tensor_read(input, shape, index); + in_out_t value = erf(value1); + tensor_write(output, shape, index, value); +} diff --git a/pseudocode/operators/IDENTITY.tosac b/pseudocode/operators/IDENTITY.tosac new file mode 100644 index 0000000..28d71af --- /dev/null +++ b/pseudocode/operators/IDENTITY.tosac @@ -0,0 +1,10 @@ +// +// This confidential and proprietary software may be used only as +// authorised by a licensing agreement from ARM Limited +// (C) COPYRIGHT 2024 ARM Limited +// ALL RIGHTS RESERVED +// The entire notice above must be reproduced on all authorised +// copies and copies may only be made to the extent permitted +// by a licensing agreement from ARM Limited. + +output = input1; -- cgit v1.2.1