1 | /* |
---|
2 | Copyright (C) 2018 Paul Brossier <piem@aubio.org> |
---|
3 | |
---|
4 | This file is part of aubio. |
---|
5 | |
---|
6 | aubio is free software: you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation, either version 3 of the License, or |
---|
9 | (at your option) any later version. |
---|
10 | |
---|
11 | aubio is distributed in the hope that it will be useful, |
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | GNU General Public License for more details. |
---|
15 | |
---|
16 | You should have received a copy of the GNU General Public License |
---|
17 | along with aubio. If not, see <http://www.gnu.org/licenses/>. |
---|
18 | |
---|
19 | */ |
---|
20 | |
---|
21 | #ifndef AUBIO_BATCHNORM_H |
---|
22 | #define AUBIO_BATCHNORM_H |
---|
23 | |
---|
24 | #ifdef __cplusplus |
---|
25 | extern "C" { |
---|
26 | #endif |
---|
27 | |
---|
28 | /** \file |
---|
29 | |
---|
30 | Batch normalization layer. |
---|
31 | |
---|
32 | References |
---|
33 | ---------- |
---|
34 | |
---|
35 | Ioffe, Sergey; Szegedy, Christian. "Batch Normalization: Accelerating Deep |
---|
36 | Network Training by Reducing Internal Covariate Shift", available online |
---|
37 | at https://arxiv.org/pdf/1502.03167.pdf |
---|
38 | |
---|
39 | */ |
---|
40 | |
---|
41 | typedef struct _aubio_batchnorm_t aubio_batchnorm_t; |
---|
42 | |
---|
43 | aubio_batchnorm_t *new_aubio_batchnorm(uint_t n_outputs); |
---|
44 | |
---|
45 | void aubio_batchnorm_do(aubio_batchnorm_t *t, |
---|
46 | aubio_tensor_t *input_tensor, |
---|
47 | aubio_tensor_t *activations); |
---|
48 | |
---|
49 | uint_t aubio_batchnorm_set_gamma(aubio_batchnorm_t *t, fvec_t *gamma); |
---|
50 | uint_t aubio_batchnorm_set_beta(aubio_batchnorm_t *t, fvec_t *beta); |
---|
51 | uint_t aubio_batchnorm_set_moving_mean(aubio_batchnorm_t *t, fvec_t *moving_mean); |
---|
52 | uint_t aubio_batchnorm_set_moving_variance(aubio_batchnorm_t *t, fvec_t *moving_variance); |
---|
53 | |
---|
54 | fvec_t *aubio_batchnorm_get_gamma(aubio_batchnorm_t *t); |
---|
55 | fvec_t *aubio_batchnorm_get_beta(aubio_batchnorm_t *t); |
---|
56 | fvec_t *aubio_batchnorm_get_moving_mean(aubio_batchnorm_t *t); |
---|
57 | fvec_t *aubio_batchnorm_get_moving_variance(aubio_batchnorm_t *t); |
---|
58 | |
---|
59 | uint_t aubio_batchnorm_get_output_shape(aubio_batchnorm_t *t, |
---|
60 | aubio_tensor_t *input, uint_t *shape); |
---|
61 | |
---|
62 | void del_aubio_batchnorm(aubio_batchnorm_t *t); |
---|
63 | |
---|
64 | #ifdef __cplusplus |
---|
65 | } |
---|
66 | #endif |
---|
67 | |
---|
68 | #endif /* AUBIO_BATCHNORM_H */ |
---|