1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
| #ifndef CONVOLUTIONAL_LAYER_H
| #define CONVOLUTIONAL_LAYER_H
|
| #ifdef GPU
| #include "opencl.h"
| #endif
|
| #include "image.h"
| #include "activations.h"
|
| typedef struct {
| int batch;
| int h,w,c;
| int n;
| int size;
| int stride;
| int pad;
| float *filters;
| float *filter_updates;
| float *filter_momentum;
|
| float *biases;
| float *bias_updates;
| float *bias_momentum;
|
| float *col_image;
| float *delta;
| float *output;
|
| #ifdef GPU
| cl_mem filters_cl;
| cl_mem filter_updates_cl;
| cl_mem filter_momentum_cl;
|
| cl_mem biases_cl;
| cl_mem bias_updates_cl;
| cl_mem bias_momentum_cl;
|
| cl_mem col_image_cl;
| cl_mem delta_cl;
| cl_mem output_cl;
| #endif
|
| ACTIVATION activation;
| } convolutional_layer;
|
| #ifdef GPU
| void forward_convolutional_layer_gpu(convolutional_layer layer, cl_mem in);
| #endif
|
| convolutional_layer *make_convolutional_layer(int batch, int h, int w, int c, int n, int size, int stride, int pad, ACTIVATION activation);
| void resize_convolutional_layer(convolutional_layer *layer, int h, int w, int c);
| void forward_convolutional_layer(const convolutional_layer layer, float *in);
| void update_convolutional_layer(convolutional_layer layer, float step, float momentum, float decay);
| image *visualize_convolutional_layer(convolutional_layer layer, char *window, image *prev_filters);
|
| void backward_convolutional_layer(convolutional_layer layer, float *delta);
|
| image get_convolutional_image(convolutional_layer layer);
| image get_convolutional_delta(convolutional_layer layer);
| image get_convolutional_filter(convolutional_layer layer, int i);
|
| #endif
|
|