Skip to content

Commit

Permalink
Small optimization (5% core utilization drop)
Browse files Browse the repository at this point in the history
  • Loading branch information
mryndzionek committed Aug 24, 2024
1 parent 3bee999 commit 2c2406d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ in frames, nine frames a second.
![sharnn](https://github.com/mryndzionek/esp32s3_eye_kws_demo/blob/main/images/sharnn.png)

The core utilization is ~70%.
Core1 every 105ms does NN inference which takes about 90ms (80% core utilization).
Core1 every 105ms does NN inference which takes about 85ms (77% core utilization).

The microphone (INMP441) connections are as follows:

Expand Down
6 changes: 3 additions & 3 deletions src/fast_grnn.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ const float INPUT_STDEVS[32] =

// clang-format on

static inline float sigmoidf(float n)
static inline float sigmoidf(float x)
{
return (1 / (1 + powf(EULER_NUMBER_F, -n)));
return (tanhf(x / 2.0f) + 1.0f) / 2.0f;
}

static inline float expo(float y)
{
if (y > 80)
y = 80;
return exp(y);
return expf(y);
}

static float softmax(const float *xs, size_t n, size_t len)
Expand Down

0 comments on commit 2c2406d

Please sign in to comment.