From 1e9ba65f263a15f1f9cf9b9484047ea51237187a Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Wed, 17 Feb 2021 19:23:39 -0800 Subject: Consistency cleanup Attempt to get consistent across the pseudocode. Change the data types to all be intN_t instead of some cases of intN. Use float_t as the general floating point data type. Be consistent on use of the term "floating-point" Move general pseudocode helpers to their own section. Change-Id: Ie77666cd3ee438c71f39c62b9c424fe687b0bb51 Signed-off-by: Eric Kunze --- chapters/comparison.adoc | 54 ++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'chapters/comparison.adoc') diff --git a/chapters/comparison.adoc b/chapters/comparison.adoc index f9439fc..289196f 100644 --- a/chapters/comparison.adoc +++ b/chapters/comparison.adoc @@ -27,13 +27,13 @@ Elementwise comparison operation [source,c] ---- -for_each (index in shape) { - index1 = apply_broadcast(shape, shape1, index) - index2 = apply_broadcast(shape, shape2, index) - int32_t value1 = tensor_read(input1, shape1, index1) - int32_t value2 = tensor_read(input2, shape2, index2) - bool_t acc = (value1 == value2) ? True : False - tensor_write(output, shape, index, acc) +for_each(index in shape) { + index1 = apply_broadcast(shape, shape1, index); + index2 = apply_broadcast(shape, shape2, index); + int32_t value1 = tensor_read(input1, shape1, index1); + int32_t value2 = tensor_read(input2, shape2, index2); + bool_t acc = (value1 == value2) ? True : False; + tensor_write(output, shape, index, acc); } ---- @@ -42,8 +42,8 @@ for_each (index in shape) { |=== |Profile|Mode|in_t|out_t -|Any|signed 32|int32|bool -|MI, MT|float|float|bool +|Any|signed 32|int32_t|bool_t +|MI, MT|floating-point|float_t|bool_t |=== ==== GREATER @@ -63,13 +63,13 @@ Elementwise greater than comparison operation [source,c] ---- -for_each (index in shape) { - index1 = apply_broadcast(shape, shape1, index) - index2 = apply_broadcast(shape, shape2, index) - int32_t value1 = tensor_read(input1, shape1, index1) - int32_t value2 = tensor_read(input2, shape2, index2) - bool_t acc = (value1 > value2) ? True : False - tensor_write(output, shape, index, acc) +for_each(index in shape) { + index1 = apply_broadcast(shape, shape1, index); + index2 = apply_broadcast(shape, shape2, index); + int32_t value1 = tensor_read(input1, shape1, index1); + int32_t value2 = tensor_read(input2, shape2, index2); + bool_t acc = (value1 > value2) ? True : False; + tensor_write(output, shape, index, acc); } ---- @@ -77,8 +77,8 @@ for_each (index in shape) { |=== |Profile|Mode|in_t|out_t -|Any|signed 32|int32|bool -|MI, MT|float|float|bool +|Any|signed 32|int32_t|bool_t +|MI, MT|floating-point|float_t|bool_t |=== ==== GREATER_EQUAL @@ -99,13 +99,13 @@ Elementwise comparison operation [source,c] ---- -for_each (index in shape) { - index1 = apply_broadcast(shape, shape1, index) - index2 = apply_broadcast(shape, shape2, index) - int32_t value1 = tensor_read(input1, shape1, index1) - int32_t value2 = tensor_read(input2, shape2, index2) - bool_t acc = (value1 >= value2) ? True : False - tensor_write(output, shape, index, acc) +for_each(index in shape) { + index1 = apply_broadcast(shape, shape1, index); + index2 = apply_broadcast(shape, shape2, index); + int32_t value1 = tensor_read(input1, shape1, index1); + int32_t value2 = tensor_read(input2, shape2, index2); + bool_t acc = (value1 >= value2) ? True : False; + tensor_write(output, shape, index, acc); } ---- @@ -114,6 +114,6 @@ for_each (index in shape) { |=== |Profile|Mode|in_t|out_t -|Any|signed 32|int32|bool -|MI, MT|float|float|bool +|Any|signed 32|int32_t|bool_t +|MI, MT|floating-point|float_t|bool_t |=== -- cgit v1.2.1