XCSF  1.4.7
XCSF learning classifier system
neural_layer_avgpool.h
Go to the documentation of this file.
1 /*
2  * This program is free software: you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation, either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program. If not, see <http://www.gnu.org/licenses/>.
14  */
15 
24 #pragma once
25 
26 #include "neural_layer.h"
27 
28 void
29 neural_layer_avgpool_init(struct Layer *l, const struct ArgsLayer *args);
30 
31 struct Layer *
32 neural_layer_avgpool_copy(const struct Layer *src);
33 
34 void
36 
37 void
38 neural_layer_avgpool_forward(const struct Layer *l, const struct Net *net,
39  const double *input);
40 
41 void
42 neural_layer_avgpool_backward(const struct Layer *l, const struct Net *net,
43  const double *input, double *delta);
44 
45 void
46 neural_layer_avgpool_update(const struct Layer *l);
47 
48 void
49 neural_layer_avgpool_print(const struct Layer *l, const bool print_weights);
50 
51 bool
53 
54 void
55 neural_layer_avgpool_free(const struct Layer *l);
56 
57 double *
58 neural_layer_avgpool_output(const struct Layer *l);
59 
60 size_t
61 neural_layer_avgpool_save(const struct Layer *l, FILE *fp);
62 
63 size_t
64 neural_layer_avgpool_load(struct Layer *l, FILE *fp);
65 
66 void
67 neural_layer_avgpool_resize(struct Layer *l, const struct Layer *prev);
68 
69 char *
71  const bool return_weights);
72 
76 static struct LayerVtbl const layer_avgpool_vtbl = {
84 };
Interface for neural network layers.
void neural_layer_avgpool_rand(struct Layer *l)
Dummy function since average pooling layers have no weights.
void neural_layer_avgpool_update(const struct Layer *l)
Dummy function since average pooling layers have no weights.
void neural_layer_avgpool_backward(const struct Layer *l, const struct Net *net, const double *input, double *delta)
Backward propagates an average pooling layer.
void neural_layer_avgpool_free(const struct Layer *l)
Free memory used by an average pooling layer.
void neural_layer_avgpool_init(struct Layer *l, const struct ArgsLayer *args)
Initialises an average pooling layer.
bool neural_layer_avgpool_mutate(struct Layer *l)
Dummy function since average pooling layers cannot be mutated.
static struct LayerVtbl const layer_avgpool_vtbl
Neural average pooling layer implemented functions.
void neural_layer_avgpool_forward(const struct Layer *l, const struct Net *net, const double *input)
Forward propagates an average pooling layer.
size_t neural_layer_avgpool_load(struct Layer *l, FILE *fp)
Reads an average pooling layer from a file.
struct Layer * neural_layer_avgpool_copy(const struct Layer *src)
Initialises and copies one average pooling layer from another.
char * neural_layer_avgpool_json_export(const struct Layer *l, const bool return_weights)
Returns a json formatted string of an average pool layer.
size_t neural_layer_avgpool_save(const struct Layer *l, FILE *fp)
Writes an average pooling layer to a file.
void neural_layer_avgpool_print(const struct Layer *l, const bool print_weights)
Prints an average pooling layer.
void neural_layer_avgpool_resize(struct Layer *l, const struct Layer *prev)
Resizes an avg pooling layer if the previous layer has changed size.
double * neural_layer_avgpool_output(const struct Layer *l)
Returns the output from an average pooling layer.
Parameters for initialising a neural network layer.
Neural network layer interface data structure.
Definition: neural_layer.h:143
Neural network layer data structure.
Definition: neural_layer.h:73
double * delta
Delta for updating weights.
Definition: neural_layer.h:83
Neural network data structure.
Definition: neural.h:48