From 53849b06297d8a6ce7814ff861fbbdedccfe4523 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 29 Jan 2019 02:55:31 +0100 Subject: [PATCH] [dense] improve documentation --- src/ai/dense.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/src/ai/dense.h b/src/ai/dense.h index 687f065b..159db490 100644 --- a/src/ai/dense.h +++ b/src/ai/dense.h @@ -23,7 +23,7 @@ /** \file - Fully connected dense layer. + Fully connected layer */ @@ -31,22 +31,73 @@ extern "C" { #endif +/** dense layer */ typedef struct _aubio_dense_t aubio_dense_t; +/** create a new dense layer + + \param n_units number of units + + \return new dense layer + +*/ aubio_dense_t *new_aubio_dense(uint_t n_units); -void del_aubio_dense(aubio_dense_t *c); +/** get output shape + + \param c ::aubio_dense_t layer + \param input input tensor + \param shape output shape + + \return 0 on success, non-zero otherwise +*/ uint_t aubio_dense_get_output_shape(aubio_dense_t *c, aubio_tensor_t *input, uint_t *shape); +/** get internal weights + + \param c dense layer + + \return matrix of weights + + This function should be called after ::aubio_dense_get_output_shape + to get a pointer to the internal weight matrix. + +*/ fmat_t *aubio_dense_get_weights(aubio_dense_t *c); +/** get internal biases + + \param c dense layer + + \return vector of biases + + This function should be called after ::aubio_dense_get_output_shape + to get a pointer to the internal biases. + +*/ fvec_t *aubio_dense_get_bias(aubio_dense_t *c); +/** compute forward pass + + \param c ::aubio_dense_t layer + \param input input tensor + \param output output tensor + + This function computes the output of the dense layer given an input tensor. + +*/ void aubio_dense_do(aubio_dense_t *c, aubio_tensor_t *input, aubio_tensor_t *output); +/** destroy layer + + \param c layer to destroy + +*/ +void del_aubio_dense(aubio_dense_t *c); + #ifdef __cplusplus } #endif -- 2.11.0