From f9fcb61e143bde28fd14bcbbdb97120f5afdbfb7 Mon Sep 17 00:00:00 2001 From: Kevin Petit Date: Tue, 23 Jan 2024 19:09:29 +0000 Subject: pseudocode: use true/false consistently for boolean values - Some operators were using True and False. - Document the use of true and false in the definition of the boolean number format. Signed-off-by: Kevin Petit Change-Id: Ic4c16c8527d46ca01d22e3c70c5371821a726df8 --- chapters/introduction.adoc | 2 +- pseudocode/operators/EQUAL.tosac | 4 ++-- pseudocode/operators/GREATER.tosac | 4 ++-- pseudocode/operators/GREATER_EQUAL.tosac | 4 ++-- pseudocode/operators/RESCALE.tosac | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/chapters/introduction.adoc b/chapters/introduction.adoc index dc45808..8b5be21 100644 --- a/chapters/introduction.adoc +++ b/chapters/introduction.adoc @@ -479,7 +479,7 @@ The number formats supported by a given operator are listed in its table of supp |bool_t | - | - -|Boolean value. Size implementation defined. The TOSA reference model implements this as int8_t with 0 for false and 1 for true. All non-zero values are accepted on input as true. +|Boolean value that is either `true` or `false`. Size implementation defined. The TOSA reference model implements this as int8_t with 0 for `false` and 1 for `true`. All non-zero values are accepted on input as `true`. |i4_t | - diff --git a/pseudocode/operators/EQUAL.tosac b/pseudocode/operators/EQUAL.tosac index 67e0b64..3445e27 100644 --- a/pseudocode/operators/EQUAL.tosac +++ b/pseudocode/operators/EQUAL.tosac @@ -15,8 +15,8 @@ for_each(index in shape) { in_t value2 = tensor_read(input2, shape2, index2); out_t result; if (isNaN(value1) || isNaN(value2)) - result = False; + result = false; else - result = (value1 == value2) ? True : False; + result = (value1 == value2) ? true : false; tensor_write(output, shape, index, result); } diff --git a/pseudocode/operators/GREATER.tosac b/pseudocode/operators/GREATER.tosac index af8b4c9..3155f23 100644 --- a/pseudocode/operators/GREATER.tosac +++ b/pseudocode/operators/GREATER.tosac @@ -15,8 +15,8 @@ for_each(index in shape) { in_t value2 = tensor_read(input2, shape2, index2); out_t result; if (isNaN(value1) || isNaN(value2)) - result = False; + result = false; else - result = (value1 > value2) ? True : False; + result = (value1 > value2) ? true : false; tensor_write(output, shape, index, result); } diff --git a/pseudocode/operators/GREATER_EQUAL.tosac b/pseudocode/operators/GREATER_EQUAL.tosac index e45990d..2f43d40 100644 --- a/pseudocode/operators/GREATER_EQUAL.tosac +++ b/pseudocode/operators/GREATER_EQUAL.tosac @@ -15,8 +15,8 @@ for_each(index in shape) { in_t value2 = tensor_read(input2, shape2, index2); out_t result; if (isNaN(value1) || isNaN(value2)) - result = False; + result = false; else - result = (value1 >= value2) ? True : False; + result = (value1 >= value2) ? true : false; tensor_write(output, shape, index, result); } diff --git a/pseudocode/operators/RESCALE.tosac b/pseudocode/operators/RESCALE.tosac index 86a939b..c29bddd 100644 --- a/pseudocode/operators/RESCALE.tosac +++ b/pseudocode/operators/RESCALE.tosac @@ -12,11 +12,11 @@ for_each(index in shape) { // int8/uint8 can have zero point within their valid range // No other types can have zero point != 0 ERROR_IF(in_t != i8_t && - (in_t != i16_t || input_unsigned == False) && input_zp != 0); + (in_t != i16_t || input_unsigned == false) && input_zp != 0); ERROR_IF(out_t != i8_t && - (out_t != i16_t || output_unsigned == False) && output_zp != 0); - ERROR_IF(in_t == i16_t && input_unsigned == True && input_zp != 0 && input_zp != 32768); - ERROR_IF(out_t == i16_t && output_unsigned == True && output_zp != 0 && output_zp != 32768); + (out_t != i16_t || output_unsigned == false) && output_zp != 0); + ERROR_IF(in_t == i16_t && input_unsigned == true && input_zp != 0 && input_zp != 32768); + ERROR_IF(out_t == i16_t && output_unsigned == true && output_zp != 0 && output_zp != 32768); ERROR_IF(scale32 && in_t == i48_t); ERROR_IF(!scale32 && double_round); ERROR_IF(in_t == i16_t && out_t == i32_t && input_unsigned); -- cgit v1.2.1