diff --git a/src/cnn/include/struct.h b/src/cnn/include/struct.h index 5e4a6bf..d630e3a 100644 --- a/src/cnn/include/struct.h +++ b/src/cnn/include/struct.h @@ -2,12 +2,12 @@ #define DEF_STRUCT_H typedef struct Kernel_cnn { - int k_size; + int k_size; // k_size = dim_input - dim_output + 1 int rows; // Depth of the input int columns; // Depth of the output - float*** bias; // bias[columns][k_size][k_size] - float*** d_bias; // d_bias[columns][k_size][k_size] - float*** last_d_bias; // last_d_bias[columns][k_size][k_size] + float*** bias; // bias[columns][dim_output][dim_output] + float*** d_bias; // d_bias[columns][dim_output][dim_output] + float*** last_d_bias; // last_d_bias[columns][dim_output][dim_output] float**** w; // w[rows][columns][k_size][k_size] float**** d_w; // d_w[rows][columns][k_size][k_size] float**** last_d_w; // last_d_w[rows][columns][k_size][k_size] diff --git a/src/cnn/make.c b/src/cnn/make.c index 8d6a50c..1a3174c 100644 --- a/src/cnn/make.c +++ b/src/cnn/make.c @@ -4,6 +4,9 @@ #include "include/make.h" void make_convolution(Kernel_cnn* kernel, float*** input, float*** output, int output_dim) { + // c'est le kernel de input + // input[kernel->rows][kernel_k_size + output_dim-1][kernel_k_size + output_dim-1] + // output[kernel->columns][output_dim][output_dim] float f; int n = kernel->k_size; for (int i=0; i < kernel->columns; i++) { @@ -24,6 +27,8 @@ void make_convolution(Kernel_cnn* kernel, float*** input, float*** output, int o } void make_average_pooling(float*** input, float*** output, int size, int output_depth, int output_dim) { + // input[output_depth][output_dim+size-1][output_dim+size-1] + // output[output_depth][output_dim][output_dim] float average; int n = size*size; for (int i=0; i < output_depth; i++) { @@ -42,6 +47,8 @@ void make_average_pooling(float*** input, float*** output, int size, int output_ } void make_dense(Kernel_nn* kernel, float* input, float* output, int size_input, int size_output) { + // input[size_input] + // output[size_output] float f; for (int i=0; i < size_output; i++) { f = kernel->bias[i]; @@ -53,6 +60,8 @@ void make_dense(Kernel_nn* kernel, float* input, float* output, int size_input, } void make_dense_linearised(Kernel_nn* kernel, float*** input, float* output, int depth_input, int dim_input, int size_output) { + // input[depth_input][dim_input][dim_input] + // output[size_output] int n = depth_input*dim_input*dim_input; float f; for (int l=0; l