Skip to content

divide by 0 bug in Chapter03/ArduinoSketches/08_input_features.ino #10

@SSP6258

Description

@SSP6258

Hi

I am studying this great TonyML book, it is very practical and useful.

I am a little confuse with the example in CH3

The code in CH3 seems has divide by 0 bug, since tflu_i_scale initialized with 0

or will it be replace somewhere ?

Thank you
Jack

float   tflu_i_scale      = 0.0f;

// Store the normalized and quantized samples in the circular buffers
  t_vals[cur_idx] = quantize(t, tflu_i_scale, tflu_i_zero_point);
  h_vals[cur_idx] = quantize(h, tflu_i_scale, tflu_i_zero_point);

inline int8_t quantize(float x, float scale, float zero_point)
{
  return (x / scale) + zero_point;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions