feature/crepe
Last change
on this file since abb75ec was
387a5b1,
checked in by Paul Brossier <piem@piem.org>, 3 years ago
|
[activation] add sigmoid and relu, in-place
|
-
Property mode set to
100644
|
File size:
403 bytes
|
Line | |
---|
1 | #include "aubio_priv.h" |
---|
2 | #include "fmat.h" |
---|
3 | #include "ai/tensor.h" |
---|
4 | |
---|
5 | void aubio_activation_relu(aubio_tensor_t *t) |
---|
6 | { |
---|
7 | uint_t i; |
---|
8 | AUBIO_ASSERT(t); |
---|
9 | for (i = 0; i < t->size; i++) { |
---|
10 | t->buffer[i] = MAX(0, t->buffer[i]); |
---|
11 | } |
---|
12 | } |
---|
13 | |
---|
14 | void aubio_activation_sigmoid(aubio_tensor_t *t) |
---|
15 | { |
---|
16 | uint_t i; |
---|
17 | AUBIO_ASSERT(t); |
---|
18 | for (i = 0; i < t->size; i++) { |
---|
19 | t->buffer[i] = 1. / (1. + EXP( - t->buffer[i] )); |
---|
20 | } |
---|
21 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.