You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.2 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef CONVOLUTIONAL_LAYER_H
  2. #define CONVOLUTIONAL_LAYER_H
  3. #include "dn_cuda.h"
  4. #include "image.h"
  5. #include "activations.h"
  6. #include "layer.h"
  7. #include "network.h"
  8. namespace DN{
  9. typedef layer convolutional_layer;
  10. #ifdef GPU
  11. void forward_convolutional_layer_gpu(convolutional_layer layer, network net);
  12. void backward_convolutional_layer_gpu(convolutional_layer layer, network net);
  13. void update_convolutional_layer_gpu(convolutional_layer layer, update_args a);
  14. void push_convolutional_layer(convolutional_layer layer);
  15. void pull_convolutional_layer(convolutional_layer layer);
  16. void add_bias_gpu(float *output, float *biases, int batch, int n, int size);
  17. void backward_bias_gpu(float *bias_updates, float *delta, int batch, int n, int size);
  18. 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, int t);
  19. #ifdef CUDNN
  20. void cudnn_convolutional_setup(layer *l);
  21. #endif
  22. #endif
  23. 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);
  24. void resize_convolutional_layer(convolutional_layer *layer, int w, int h);
  25. void forward_convolutional_layer(const convolutional_layer layer, network net);
  26. void update_convolutional_layer(convolutional_layer layer, update_args a);
  27. image *visualize_convolutional_layer(convolutional_layer layer, char *window, image *prev_weights);
  28. void binarize_weights(float *weights, int n, int size, float *binary);
  29. void swap_binary(convolutional_layer *l);
  30. void binarize_weights2(float *weights, int n, int size, char *binary, float *scales);
  31. void backward_convolutional_layer(convolutional_layer layer, network net);
  32. void add_bias(float *output, float *biases, int batch, int n, int size);
  33. void backward_bias(float *bias_updates, float *delta, int batch, int n, int size);
  34. image get_convolutional_image(convolutional_layer layer);
  35. image get_convolutional_delta(convolutional_layer layer);
  36. image get_convolutional_weight(convolutional_layer layer, int i);
  37. int convolutional_out_height(convolutional_layer layer);
  38. int convolutional_out_width(convolutional_layer layer);
  39. };
  40. #endif