From 3fe5256340778f586b80ac02b0632b54a39723f1 Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Mon, 25 Oct 2021 16:06:55 -0700 Subject: Clarify CLAMP pseudocode CLAMP does not do any zero point modification of its clamp limits. Callers to CLAMP should provide values with the zero-point accounted for in the arguments. Change-Id: I27ee468ecd5ab53e33dcbac9c91b705b39e49f96 --- chapters/activation_funcs.adoc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/chapters/activation_funcs.adoc b/chapters/activation_funcs.adoc index 59030d8..a58a1fc 100644 --- a/chapters/activation_funcs.adoc +++ b/chapters/activation_funcs.adoc @@ -11,7 +11,9 @@ === Activation Functions ==== CLAMP -Clamp to an arbitrary minimum and maximum value. Note that the maximum and minimum values are specified as signed quantized values, no scaling happens before or after this operation. +Clamp to an arbitrary minimum and maximum value. +Maximum and minimum values are specified as values in the range of the input type. +No zero point subtraction is done to the values, thus to clamp to the zero point value, the zero point itself should be supplied as the minimum value. *Arguments:* @@ -29,20 +31,20 @@ Clamp to an arbitrary minimum and maximum value. Note that the maximum and minim ---- ERROR_IF(max_val < min_val); for_each(index in shape) { - acc_t value = tensor_read(input, shape, index); - acc = (in_t)apply_clip(value, min_val, max_val); - tensor_write(output, shape, index, acc); + in_t value = tensor_read(input, shape, index); + value = apply_clip(value, min_val, max_val); + tensor_write(output, shape, index, value); } ---- *Supported Data Types:* |=== -|Profile|Mode|in_t|acc_t +|Profile|Mode|in_t -|Any|signed 8|int8_t|int16_t -|Any|signed 16|int16_t|int16_t -|MI, MT|floating-point|float_t|float_t +|Any|signed 8|int8_t +|Any|signed 16|int16_t +|MI, MT|floating-point|float_t |=== ==== SIGMOID -- cgit v1.2.1