source: src/ai/batchnorm.h @ 1aa6eb8

feature/crepe_org
Last change on this file since 1aa6eb8 was 2fec649, checked in by Paul Brossier <piem@piem.org>, 6 years ago

[batchnorm] add first plain version

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