2013-11-04 23:11:01 +04:00
|
|
|
#ifndef CONVOLUTIONAL_LAYER_H
|
|
|
|
#define CONVOLUTIONAL_LAYER_H
|
|
|
|
|
2015-01-23 03:38:24 +03:00
|
|
|
#include "cuda.h"
|
2013-11-04 23:11:01 +04:00
|
|
|
#include "image.h"
|
2013-11-13 22:50:38 +04:00
|
|
|
#include "activations.h"
|
2015-05-11 23:46:49 +03:00
|
|
|
#include "layer.h"
|
2015-12-14 22:57:10 +03:00
|
|
|
#include "network.h"
|
2013-11-04 23:11:01 +04:00
|
|
|
|
2015-05-11 23:46:49 +03:00
|
|
|
typedef layer convolutional_layer;
|
2013-11-04 23:11:01 +04:00
|
|
|
|
2014-05-10 02:14:52 +04:00
|
|
|
#ifdef GPU
|
2017-04-10 05:56:42 +03:00
|
|
|
void forward_convolutional_layer_gpu(convolutional_layer layer, network net);
|
|
|
|
void backward_convolutional_layer_gpu(convolutional_layer layer, network net);
|
2015-03-22 19:56:40 +03:00
|
|
|
void update_convolutional_layer_gpu(convolutional_layer layer, int batch, float learning_rate, float momentum, float decay);
|
2015-02-10 00:27:58 +03:00
|
|
|
|
2014-10-25 22:57:26 +04:00
|
|
|
void push_convolutional_layer(convolutional_layer layer);
|
2015-01-13 04:27:08 +03:00
|
|
|
void pull_convolutional_layer(convolutional_layer layer);
|
2015-02-10 00:27:58 +03:00
|
|
|
|
2015-11-04 06:23:17 +03:00
|
|
|
void add_bias_gpu(float *output, float *biases, int batch, int n, int size);
|
2015-02-10 00:27:58 +03:00
|
|
|
void backward_bias_gpu(float *bias_updates, float *delta, int batch, int n, int size);
|
2017-04-10 05:56:42 +03:00
|
|
|
void adam_update_gpu(float *w, float *d, float *m, float *v, float B1, float B2, float eps, float decay, float rate, int n, int batch);
|
2016-06-14 21:30:28 +03:00
|
|
|
#ifdef CUDNN
|
|
|
|
void cudnn_convolutional_setup(layer *l);
|
|
|
|
#endif
|
2014-05-10 02:14:52 +04:00
|
|
|
#endif
|
|
|
|
|
2016-10-26 18:35:44 +03:00
|
|
|
convolutional_layer make_convolutional_layer(int batch, int h, int w, int c, int n, int size, int stride, int padding, ACTIVATION activation, int batch_normalize, int binary, int xnor, int adam);
|
2015-11-04 06:23:17 +03:00
|
|
|
void denormalize_convolutional_layer(convolutional_layer l);
|
2015-07-08 10:36:43 +03:00
|
|
|
void resize_convolutional_layer(convolutional_layer *layer, int w, int h);
|
2017-04-10 05:56:42 +03:00
|
|
|
void forward_convolutional_layer(const convolutional_layer layer, network net);
|
2015-03-22 19:56:40 +03:00
|
|
|
void update_convolutional_layer(convolutional_layer layer, int batch, float learning_rate, float momentum, float decay);
|
2016-09-12 23:55:20 +03:00
|
|
|
image *visualize_convolutional_layer(convolutional_layer layer, char *window, image *prev_weights);
|
|
|
|
void binarize_weights(float *weights, int n, int size, float *binary);
|
2016-03-16 14:30:48 +03:00
|
|
|
void swap_binary(convolutional_layer *l);
|
2016-09-12 23:55:20 +03:00
|
|
|
void binarize_weights2(float *weights, int n, int size, char *binary, float *scales);
|
2014-01-28 11:16:56 +04:00
|
|
|
|
2017-04-10 05:56:42 +03:00
|
|
|
void backward_convolutional_layer(convolutional_layer layer, network net);
|
2013-11-13 22:50:38 +04:00
|
|
|
|
2015-12-19 02:55:58 +03:00
|
|
|
void add_bias(float *output, float *biases, int batch, int n, int size);
|
2015-02-10 00:27:58 +03:00
|
|
|
void backward_bias(float *bias_updates, float *delta, int batch, int n, int size);
|
|
|
|
|
2017-04-10 05:56:42 +03:00
|
|
|
image *get_weights(convolutional_layer l);
|
2013-11-13 22:50:38 +04:00
|
|
|
image get_convolutional_image(convolutional_layer layer);
|
|
|
|
image get_convolutional_delta(convolutional_layer layer);
|
2016-09-12 23:55:20 +03:00
|
|
|
image get_convolutional_weight(convolutional_layer layer, int i);
|
2013-11-04 23:11:01 +04:00
|
|
|
|
2015-01-23 03:38:24 +03:00
|
|
|
int convolutional_out_height(convolutional_layer layer);
|
|
|
|
int convolutional_out_width(convolutional_layer layer);
|
2016-09-12 23:55:20 +03:00
|
|
|
void rescale_weights(convolutional_layer l, float scale, float trans);
|
|
|
|
void rgbgr_weights(convolutional_layer l);
|
2015-01-23 03:38:24 +03:00
|
|
|
|
2013-11-04 23:11:01 +04:00
|
|
|
#endif
|
|
|
|
|