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 | void aubio_batchnorm_train(aubio_batchnorm_t *t, aubio_tensor_t *input); |
---|
50 | |
---|
51 | uint_t aubio_batchnorm_set_gamma(aubio_batchnorm_t *t, fvec_t *gamma); |
---|
52 | uint_t aubio_batchnorm_set_beta(aubio_batchnorm_t *t, fvec_t *beta); |
---|
53 | uint_t aubio_batchnorm_set_moving_mean(aubio_batchnorm_t *t, fvec_t *moving_mean); |
---|
54 | uint_t aubio_batchnorm_set_moving_variance(aubio_batchnorm_t *t, fvec_t *moving_variance); |
---|
55 | |
---|
56 | fvec_t *aubio_batchnorm_get_gamma(aubio_batchnorm_t *t); |
---|
57 | fvec_t *aubio_batchnorm_get_beta(aubio_batchnorm_t *t); |
---|
58 | fvec_t *aubio_batchnorm_get_moving_mean(aubio_batchnorm_t *t); |
---|
59 | fvec_t *aubio_batchnorm_get_moving_variance(aubio_batchnorm_t *t); |
---|
60 | |
---|
61 | uint_t aubio_batchnorm_get_output_shape(aubio_batchnorm_t *t, |
---|
62 | aubio_tensor_t *input, uint_t *shape); |
---|
63 | |
---|
64 | void del_aubio_batchnorm(aubio_batchnorm_t *t); |
---|
65 | |
---|
66 | #ifdef __cplusplus |
---|
67 | } |
---|
68 | #endif |
---|
69 | |
---|
70 | #endif /* AUBIO_BATCHNORM_H */ |
---|