Addressed review comments.
This commit is contained in:
parent
0f047cd174
commit
7d76b0ac7f
@ -430,15 +430,15 @@ TfLiteStatus TanhPrepare(TfLiteContext* context, TfLiteNode* node) {
|
|||||||
TF_LITE_ENSURE_EQ(context, output->params.zero_point, 0);
|
TF_LITE_ENSURE_EQ(context, output->params.zero_point, 0);
|
||||||
|
|
||||||
int input_scale_log2_rounded;
|
int input_scale_log2_rounded;
|
||||||
bool paramScalePOT =
|
bool param_scale_pot =
|
||||||
CheckedLog2(input->params.scale, &input_scale_log2_rounded);
|
CheckedLog2(input->params.scale, &input_scale_log2_rounded);
|
||||||
|
|
||||||
data->input_left_shift =
|
data->input_left_shift =
|
||||||
(15 - kInputIntegerBits) + input_scale_log2_rounded;
|
(15 - kInputIntegerBits) + input_scale_log2_rounded;
|
||||||
paramScalePOT &=
|
param_scale_pot &=
|
||||||
(data->input_left_shift == 0 || data->input_left_shift == 1);
|
(data->input_left_shift == 0 || data->input_left_shift == 1);
|
||||||
|
|
||||||
if (!paramScalePOT) {
|
if (!param_scale_pot) {
|
||||||
// In case of general scale parameter, we need to do a rescaling.
|
// In case of general scale parameter, we need to do a rescaling.
|
||||||
// Magic constant 4096:
|
// Magic constant 4096:
|
||||||
// We need to scale down to (-2^3, 2^3) / 3 is kInputIntegerBits/ interval
|
// We need to scale down to (-2^3, 2^3) / 3 is kInputIntegerBits/ interval
|
||||||
@ -526,14 +526,14 @@ TfLiteStatus SigmoidPrepare(TfLiteContext* context, TfLiteNode* node) {
|
|||||||
TF_LITE_ENSURE_EQ(context, output->params.zero_point, 0);
|
TF_LITE_ENSURE_EQ(context, output->params.zero_point, 0);
|
||||||
|
|
||||||
int input_scale_log2_rounded;
|
int input_scale_log2_rounded;
|
||||||
bool paramScalePOT =
|
bool param_scale_pot =
|
||||||
CheckedLog2(input->params.scale, &input_scale_log2_rounded);
|
CheckedLog2(input->params.scale, &input_scale_log2_rounded);
|
||||||
|
|
||||||
data->input_left_shift =
|
data->input_left_shift =
|
||||||
(15 - kInputIntegerBits) + input_scale_log2_rounded;
|
(15 - kInputIntegerBits) + input_scale_log2_rounded;
|
||||||
paramScalePOT &= (data->input_left_shift == 0);
|
param_scale_pot &= (data->input_left_shift == 0);
|
||||||
|
|
||||||
if (!paramScalePOT) {
|
if (!param_scale_pot) {
|
||||||
// In case of general scale parameter, we need to do a rescaling.
|
// In case of general scale parameter, we need to do a rescaling.
|
||||||
// Magic constant 4096:
|
// Magic constant 4096:
|
||||||
// We need to scale down to (-2^3, 2^3) / 3 is kInputIntegerBits/ interval
|
// We need to scale down to (-2^3, 2^3) / 3 is kInputIntegerBits/ interval
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user