Updates in comments

This commit is contained in:
julienChemillier 2022-11-01 10:10:43 +01:00
parent 025e669942
commit 3d63e9e63b
2 changed files with 13 additions and 4 deletions

View File

@ -2,12 +2,12 @@
#define DEF_STRUCT_H #define DEF_STRUCT_H
typedef struct Kernel_cnn { typedef struct Kernel_cnn {
int k_size; int k_size; // k_size = dim_input - dim_output + 1
int rows; // Depth of the input int rows; // Depth of the input
int columns; // Depth of the output int columns; // Depth of the output
float*** bias; // bias[columns][k_size][k_size] float*** bias; // bias[columns][dim_output][dim_output]
float*** d_bias; // d_bias[columns][k_size][k_size] float*** d_bias; // d_bias[columns][dim_output][dim_output]
float*** last_d_bias; // last_d_bias[columns][k_size][k_size] float*** last_d_bias; // last_d_bias[columns][dim_output][dim_output]
float**** w; // w[rows][columns][k_size][k_size] float**** w; // w[rows][columns][k_size][k_size]
float**** d_w; // d_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] float**** last_d_w; // last_d_w[rows][columns][k_size][k_size]

View File

@ -4,6 +4,9 @@
#include "include/make.h" #include "include/make.h"
void make_convolution(Kernel_cnn* kernel, float*** input, float*** output, int output_dim) { 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; float f;
int n = kernel->k_size; int n = kernel->k_size;
for (int i=0; i < kernel->columns; i++) { 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) { 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; float average;
int n = size*size; int n = size*size;
for (int i=0; i < output_depth; i++) { 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) { void make_dense(Kernel_nn* kernel, float* input, float* output, int size_input, int size_output) {
// input[size_input]
// output[size_output]
float f; float f;
for (int i=0; i < size_output; i++) { for (int i=0; i < size_output; i++) {
f = kernel->bias[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) { 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; int n = depth_input*dim_input*dim_input;
float f; float f;
for (int l=0; l<size_output; l++) { for (int l=0; l<size_output; l++) {