source: src/ai/batchnorm.h @ 51c0b61

feature/crepe_org
Last change on this file since 51c0b61 was 689ba93, checked in by Paul Brossier <piem@piem.org>, 6 years ago

[batchnorm] accepts any input size, allocate weights in get_output_shape

  • Property mode set to 100644
File size: 2.0 KB
Line 
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
25extern "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
41typedef struct _aubio_batchnorm_t aubio_batchnorm_t;
42
43aubio_batchnorm_t *new_aubio_batchnorm(void);
44
45void aubio_batchnorm_do(aubio_batchnorm_t *t,
46        aubio_tensor_t *input_tensor,
47        aubio_tensor_t *activations);
48
49uint_t aubio_batchnorm_set_gamma(aubio_batchnorm_t *t, fvec_t *gamma);
50uint_t aubio_batchnorm_set_beta(aubio_batchnorm_t *t, fvec_t *beta);
51uint_t aubio_batchnorm_set_moving_mean(aubio_batchnorm_t *t, fvec_t *moving_mean);
52uint_t aubio_batchnorm_set_moving_variance(aubio_batchnorm_t *t, fvec_t *moving_variance);
53
54fvec_t *aubio_batchnorm_get_gamma(aubio_batchnorm_t *t);
55fvec_t *aubio_batchnorm_get_beta(aubio_batchnorm_t *t);
56fvec_t *aubio_batchnorm_get_moving_mean(aubio_batchnorm_t *t);
57fvec_t *aubio_batchnorm_get_moving_variance(aubio_batchnorm_t *t);
58
59uint_t aubio_batchnorm_get_output_shape(aubio_batchnorm_t *t,
60        aubio_tensor_t *input, uint_t *shape);
61
62void del_aubio_batchnorm(aubio_batchnorm_t *t);
63
64#ifdef __cplusplus
65}
66#endif
67
68#endif /* AUBIO_BATCHNORM_H */
Note: See TracBrowser for help on using the repository browser.