feature/crepe_org
Last change
on this file since e2010b3 was
1bba23e,
checked in by Paul Brossier <piem@piem.org>, 6 years ago
|
[activation] add sigmoid and relu, in-place
|
-
Property mode set to
100644
|
File size:
403 bytes
|
Rev | Line | |
---|
[1bba23e] | 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.