diff options
author | Eric Kunze <eric.kunze@arm.com> | 2021-10-25 16:13:22 -0700 |
---|---|---|
committer | Eric Kunze <eric.kunze@arm.com> | 2021-10-28 09:57:55 -0700 |
commit | 82f19e2ad25bcbdde8e7f8b6bd6a6064a207fe36 (patch) | |
tree | c7a685d03bf2a9dd5a171b6c7409baf8c687da4f /chapters/ewise_unary.adoc | |
parent | 3fe5256340778f586b80ac02b0632b54a39723f1 (diff) | |
download | specification-82f19e2ad25bcbdde8e7f8b6bd6a6064a207fe36.tar.gz |
Readability fixes for pseudocode
Avoid use of acc for variables when they are not convolution
accumulators.
Use argument types appropriately.
Add missing pseudocode for some MI operators
Change-Id: I9113f9228dbcafb85206bcc39310e9599cb12c08
Diffstat (limited to 'chapters/ewise_unary.adoc')
-rw-r--r-- | chapters/ewise_unary.adoc | 79 |
1 files changed, 72 insertions, 7 deletions
diff --git a/chapters/ewise_unary.adoc b/chapters/ewise_unary.adoc index e2b754a..633b8ac 100644 --- a/chapters/ewise_unary.adoc +++ b/chapters/ewise_unary.adoc @@ -62,8 +62,8 @@ Elementwise bitwise NOT of input tensor. ---- for_each(index in shape) { in_t value1 = tensor_read<in_t>(input1, shape, index); - in_t acc = ~value1; - tensor_write<in_t>(output, shape, index, acc); + in_t result = ~value1; + tensor_write<in_t>(output, shape, index, result); } ---- @@ -90,6 +90,17 @@ Elementwise ceiling operation |Output|in_t*|output|shape|Output tensor of same type, size as the input tensor |=== +*Operation Function:* + +[source,c++] +---- +for_each(index in shape) { + in_t value1 = tensor_read<in_t>(input1, shape, index); + in_t result = apply_ceil<in_t>(value1); + tensor_write<in_t>(output, shape, index, result); +} +---- + *Supported Data Types:* |=== @@ -116,10 +127,9 @@ Elementwise count leading zeros operation [source,c++] ---- for_each(index in shape) { - in_t acc = 0; in_t value1 = tensor_read<in_t>(input1, shape, index); - acc = count_leading_zeros(value1); - tensor_write<in_t>(output, shape, index, acc); + in_t result = count_leading_zeros(value1); + tensor_write<in_t>(output, shape, index, result); } ---- @@ -143,6 +153,17 @@ Elementwise e to the x operation |Output|in_t*|output|shape|Output tensor of same type, size as the input tensor |=== +*Operation Function:* + +[source,c++] +---- +for_each(index in shape) { + in_t value1 = tensor_read<in_t>(input1, shape, index); + in_t result = apply_exp<in_t>(value1); + tensor_write<in_t>(output, shape, index, result); +} +---- + *Supported Data Types:* |=== @@ -164,6 +185,17 @@ Elementwise floor operation |Output|in_t*|output|shape|Output tensor of same type, size as the input tensor |=== +*Operation Function:* + +[source,c++] +---- +for_each(index in shape) { + in_t value1 = tensor_read<in_t>(input1, shape, index); + in_t result = apply_floor<in_t>(value1); + tensor_write<in_t>(output, shape, index, result); +} +---- + *Supported Data Types:* |=== @@ -185,6 +217,17 @@ Elementwise natural logarithm operation |Output|in_t*|output|shape|Output tensor of same type, size as the input tensor |=== +*Operation Function:* + +[source,c++] +---- +for_each(index in shape) { + in_t value1 = tensor_read<in_t>(input1, shape, index); + in_t result = apply_log<in_t>(value1); + tensor_write<in_t>(output, shape, index, result); +} +---- + *Supported Data Types:* |=== @@ -212,8 +255,8 @@ Elementwise logical NOT of input. ---- for_each(index in shape) { in_t value1 = tensor_read<in_t>(input1, shape1, index); - in_t acc = !value1; - tensor_write<in_t>(output, shape, index, acc); + in_t result = !value1; + tensor_write<in_t>(output, shape, index, result); } ---- @@ -279,6 +322,17 @@ Elementwise reciprocal operation. For integer operation, a TABLE should be used |Output|in_t*|output|shape|Output tensor of same type, size as the input tensor |=== +*Operation Function:* + +[source,c++] +---- +for_each(index in shape) { + in_t value1 = tensor_read<in_t>(input1, shape1, index); + in_t result = 1.0 / value1; + tensor_write<in_t>(output, shape, index, result); +} +---- + *Supported Data Types:* |=== @@ -300,6 +354,17 @@ Elementwise reciprocal square root operation. For integer operation, a TABLE sho |Output|in_t*|output|shape|Output tensor of same type, size as the input tensor |=== +*Operation Function:* + +[source,c++] +---- +for_each(index in shape) { + in_t value1 = tensor_read<in_t>(input1, shape1, index); + in_t result = 1.0 / apply_sqrt<in_t>(value1); + tensor_write<in_t>(output, shape, index, result); +} +---- + *Supported Data Types:* |=== |