diff options
author | Eric Kunze <eric.kunze@arm.com> | 2021-03-11 15:38:22 -0800 |
---|---|---|
committer | Eric Kunze <eric.kunze@arm.com> | 2021-03-11 15:39:53 -0800 |
commit | 839830a72ebb27c4a818e15d3334e79085906dc8 (patch) | |
tree | 9999a6fc050d75122eb0a46a215558c0665d6e91 /chapters/activation_funcs.adoc | |
parent | 8e4a9d33f0527107fda724fc0f7b6b7c1f42bf79 (diff) | |
download | specification-839830a72ebb27c4a818e15d3334e79085906dc8.tar.gz |
Make pseudocode block tags consistent
They are all now [source,c++] and use ---- as the
delimiter.
Also made the pseudocode indentation consistent (4 spaces)
in the introduction sections.
Signed-off-by: Eric Kunze <eric.kunze@arm.com>
Change-Id: I1287a60cfeae8b7e3c63b9fc8885b1ebf3d3386d
Diffstat (limited to 'chapters/activation_funcs.adoc')
-rw-r--r-- | chapters/activation_funcs.adoc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/chapters/activation_funcs.adoc b/chapters/activation_funcs.adoc index 7a4a7b6..5c8e36f 100644 --- a/chapters/activation_funcs.adoc +++ b/chapters/activation_funcs.adoc @@ -25,13 +25,14 @@ Clamp to an arbitrary minimum and maximum value. Note that the maximum and minim |=== *Operation Function:* -.... +[source,c++] +---- for_each(index in shape) { acc_t value = tensor_read<in_t>(input, shape, index); acc = (in_t)apply_clip<acc_t>(value, min_val, max_val); tensor_write<in_t>(output, shape, index, acc); } -.... +---- *Supported Data Types:* @@ -59,7 +60,7 @@ ReLU with a scalar maximum value. *Operation Function:* -[source,c] +[source,c++] ---- for_each(index in shape) { in_t value = tensor_read<in_t>(input, shape, index); @@ -86,8 +87,8 @@ the following definition. The sigmoid table has 513 entries each of 16-bit precision and covering the input range -16.0 to +16.0 in steps of 1/16. -[source,c] -.... +[source,c++] +---- int sigmoid_reference(int x) {|// input x range is -256 to + 256 inclusive F64 v = (double)x / (double)16; v = 1.0/(1.0 + exp(-v)); @@ -95,7 +96,7 @@ int sigmoid_reference(int x) {|// input x range is -256 to + 256 inclusive } generate_lookup_table(&sigmoid_table, &sigmoid_reference); -.... +---- *Arguments:* @@ -123,7 +124,7 @@ the following definition. The tanh_table has 513 entries each of 16-bit precision and covering the input range -8.0 to +8.0 in steps of 1/32. The table is specified by: -[source,c] +[source,c++] ---- int tanh_reference(int x) { // input x range is -256 to +256 inclusive F64 v = (double)x/(double)32; |