00001 #ifndef CONVOLUTIONAL_LAYER_H 00002 #define CONVOLUTIONAL_LAYER_H 00003 00004 #include "cuda.h" 00005 #include "image.h" 00006 #include "activations.h" 00007 #include "layer.h" 00008 #include "network.h" 00009 00010 typedef layer convolutional_layer; 00011 00012 #ifdef GPU 00013 void forward_convolutional_layer_gpu(convolutional_layer layer, network_state state); 00014 void backward_convolutional_layer_gpu(convolutional_layer layer, network_state state); 00015 void update_convolutional_layer_gpu(convolutional_layer layer, int batch, float learning_rate, float momentum, float decay); 00016 00017 void push_convolutional_layer(convolutional_layer layer); 00018 void pull_convolutional_layer(convolutional_layer layer); 00019 00020 void add_bias_gpu(float *output, float *biases, int batch, int n, int size); 00021 void backward_bias_gpu(float *bias_updates, float *delta, int batch, int n, int size); 00022 #ifdef CUDNN 00023 void cudnn_convolutional_setup(layer *l); 00024 #endif 00025 #endif 00026 00027 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); 00028 void denormalize_convolutional_layer(convolutional_layer l); 00029 void resize_convolutional_layer(convolutional_layer *layer, int w, int h); 00030 void forward_convolutional_layer(const convolutional_layer layer, network_state state); 00031 void update_convolutional_layer(convolutional_layer layer, int batch, float learning_rate, float momentum, float decay); 00032 image *visualize_convolutional_layer(convolutional_layer layer, char *window, image *prev_weights); 00033 void binarize_weights(float *weights, int n, int size, float *binary); 00034 void swap_binary(convolutional_layer *l); 00035 void binarize_weights2(float *weights, int n, int size, char *binary, float *scales); 00036 00037 void backward_convolutional_layer(convolutional_layer layer, network_state state); 00038 00039 void add_bias(float *output, float *biases, int batch, int n, int size); 00040 void backward_bias(float *bias_updates, float *delta, int batch, int n, int size); 00041 00042 image get_convolutional_image(convolutional_layer layer); 00043 image get_convolutional_delta(convolutional_layer layer); 00044 image get_convolutional_weight(convolutional_layer layer, int i); 00045 00046 int convolutional_out_height(convolutional_layer layer); 00047 int convolutional_out_width(convolutional_layer layer); 00048 void rescale_weights(convolutional_layer l, float scale, float trans); 00049 void rgbgr_weights(convolutional_layer l); 00050 00051 #endif 00052