source: src/ai/dense.h @ befee7a

feature/crepe_org
Last change on this file since befee7a was 30cb440e, checked in by Paul Brossier <piem@piem.org>, 6 years ago

[dense] improve documentation

  • Property mode set to 100644
File size: 2.2 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_DENSE_H
22#define AUBIO_DENSE_H
23
24/** \file
25
26 Fully connected layer
27
28*/
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/** dense layer */
35typedef struct _aubio_dense_t aubio_dense_t;
36
37/** create a new dense layer
38
39  \param n_units    number of units
40
41  \return new dense layer
42
43*/
44aubio_dense_t *new_aubio_dense(uint_t n_units);
45
46/** get output shape
47
48  \param c      ::aubio_dense_t layer
49  \param input  input tensor
50  \param shape  output shape
51
52  \return 0 on success, non-zero otherwise
53
54*/
55uint_t aubio_dense_get_output_shape(aubio_dense_t *c,
56    aubio_tensor_t *input, uint_t *shape);
57
58/** get internal weights
59
60   \param c     dense layer
61
62   \return matrix of weights
63
64   This function should be called after ::aubio_dense_get_output_shape
65   to get a pointer to the internal weight matrix.
66
67*/
68fmat_t *aubio_dense_get_weights(aubio_dense_t *c);
69
70/** get internal biases
71
72   \param c     dense layer
73
74   \return vector of biases
75
76   This function should be called after ::aubio_dense_get_output_shape
77   to get a pointer to the internal biases.
78
79*/
80fvec_t *aubio_dense_get_bias(aubio_dense_t *c);
81
82/** compute forward pass
83
84  \param c          ::aubio_dense_t layer
85  \param input      input tensor
86  \param output     output tensor
87
88  This function computes the output of the dense layer given an input tensor.
89
90*/
91void aubio_dense_do(aubio_dense_t *c, aubio_tensor_t *input,
92    aubio_tensor_t *output);
93
94/** destroy layer
95
96  \param c  layer to destroy
97
98*/
99void del_aubio_dense(aubio_dense_t *c);
100
101#ifdef __cplusplus
102}
103#endif
104
105#endif /* AUBIO_DENSE_H */
Note: See TracBrowser for help on using the repository browser.