From 1c16f5447886826cd86d0fe2893dcd193c42dcec Mon Sep 17 00:00:00 2001 From: Kevin Petit Date: Tue, 16 Jan 2024 21:40:08 +0000 Subject: pseudocode: a collection of trivial fixes - Add missing parenthesis in ARITHMETIC_SHIFT_RIGHT - Add missing semicolons - Remove stray dot in VARIABLE_WRITE Change-Id: I28ab7c80c735995437588fffeffb1f12d112f3ec Signed-off-by: Kevin Petit --- pseudocode/operators/ARITHMETIC_RIGHT_SHIFT.tosac | 2 +- pseudocode/operators/CAST.tosac | 2 +- pseudocode/operators/NEGATE.tosac | 4 ++-- pseudocode/operators/TRANSPOSE.tosac | 4 ++-- pseudocode/operators/TRANSPOSE_CONV2D.tosac | 2 +- pseudocode/operators/VARIABLE_WRITE.tosac | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pseudocode/operators/ARITHMETIC_RIGHT_SHIFT.tosac b/pseudocode/operators/ARITHMETIC_RIGHT_SHIFT.tosac index 4077146..7ed4886 100644 --- a/pseudocode/operators/ARITHMETIC_RIGHT_SHIFT.tosac +++ b/pseudocode/operators/ARITHMETIC_RIGHT_SHIFT.tosac @@ -21,7 +21,7 @@ for_each(index in shape) { in_out_t result = apply_arith_rshift(value1, value2); if (round == true && static_cast(value2) > 0 && - (apply_arith_rshift(value1, apply_sub_s(value2, 1)) & 1 != 0) { + (apply_arith_rshift(value1, apply_sub_s(value2, 1)) & 1 != 0)) { result = result + 1; } result = apply_clip_s(result, minimum_s, maximum_s); diff --git a/pseudocode/operators/CAST.tosac b/pseudocode/operators/CAST.tosac index f6306b3..8d816ca 100644 --- a/pseudocode/operators/CAST.tosac +++ b/pseudocode/operators/CAST.tosac @@ -23,5 +23,5 @@ for_each(index in shape) { } else { out = truncate(in); } - tensor_write(output, shape, index, out) + tensor_write(output, shape, index, out); } diff --git a/pseudocode/operators/NEGATE.tosac b/pseudocode/operators/NEGATE.tosac index 8c235f1..cae57f3 100644 --- a/pseudocode/operators/NEGATE.tosac +++ b/pseudocode/operators/NEGATE.tosac @@ -7,8 +7,8 @@ // copies and copies may only be made to the extent permitted // by a licensing agreement from ARM Limited. -ERROR_IF(in_out_t != i8_t && input1_zp != 0) // Zero point only for int8_t -ERROR_IF(in_out_t != i8_t && output_zp != 0) // Zero point only for int8_t +ERROR_IF(in_out_t != i8_t && input1_zp != 0); // Zero point only for int8_t +ERROR_IF(in_out_t != i8_t && output_zp != 0); // Zero point only for int8_t for_each(index in shape) { in_out_t value1 = tensor_read(input1, shape, index); acc_t value = apply_sub_s(sign_extend(value1), diff --git a/pseudocode/operators/TRANSPOSE.tosac b/pseudocode/operators/TRANSPOSE.tosac index a8f0815..e75db79 100644 --- a/pseudocode/operators/TRANSPOSE.tosac +++ b/pseudocode/operators/TRANSPOSE.tosac @@ -22,13 +22,13 @@ for_each(index in perms) { // Ensure that the output shapes have the properly // permuted shapes for(i = 0; i < rank(shape); i++) { - ERROR_IF(shape1[perms[i]] != shape[i]) + ERROR_IF(shape1[perms[i]] != shape[i]); } for_each(index in shape) { dim_t tmp_index = index; for(i = 0; i < rank(shape); i++) { - tmp_index[perms[i]] = index[i] + tmp_index[perms[i]] = index[i]; } in_out_t value = tensor_read(input1, shape1, tmp_index); tensor_write(output, shape, index, value); diff --git a/pseudocode/operators/TRANSPOSE_CONV2D.tosac b/pseudocode/operators/TRANSPOSE_CONV2D.tosac index 3aa0e23..ab61348 100644 --- a/pseudocode/operators/TRANSPOSE_CONV2D.tosac +++ b/pseudocode/operators/TRANSPOSE_CONV2D.tosac @@ -17,7 +17,7 @@ ERROR_IF(OW != (IW - 1) * stride_x + out_pad_left + out_pad_right + KW); ERROR_IF(BC != OC && BC != 1); for_each(index in [N, OH, OW, OC]) { - tensor_write(output, [N,OH,OW,OC], index, bias[(BC == 1) ? 0 : index[3]]) + tensor_write(output, [N,OH,OW,OC], index, bias[(BC == 1) ? 0 : index[3]]); } for_each(0 <= n < N, 0 <= iy < IH, 0 <= ix < IW, 0 <= oc < OC, 0 <= ic < IC, 0 <= ky < KH, 0 <= kx < KW) { diff --git a/pseudocode/operators/VARIABLE_WRITE.tosac b/pseudocode/operators/VARIABLE_WRITE.tosac index 83c5525..245fff5 100644 --- a/pseudocode/operators/VARIABLE_WRITE.tosac +++ b/pseudocode/operators/VARIABLE_WRITE.tosac @@ -8,7 +8,7 @@ // by a licensing agreement from ARM Limited. -tensor_t. variable_tensor = variable_tensor_lookup(uid); +tensor_t variable_tensor = variable_tensor_lookup(uid); // Check this variable tensor has been declared REQUIRE(variable_tensor); // The tensor has to be seen before to be written to -- cgit v1.2.1