mirror of
https://github.com/augustin64/projet-tipe
synced 2025-02-02 19:39:39 +01:00
Remove an useless allocation of memory
This commit is contained in:
parent
d916c6c86b
commit
ba05923c78
@ -33,7 +33,6 @@ Network* create_network(int max_size, float learning_rate, int dropout, int init
|
|||||||
network->width[0] = input_width;
|
network->width[0] = input_width;
|
||||||
network->depth[0] = input_depth;
|
network->depth[0] = input_depth;
|
||||||
create_a_cube_input_layer(network, 0, input_depth, input_width);
|
create_a_cube_input_layer(network, 0, input_depth, input_width);
|
||||||
create_a_cube_input_z_layer(network, 0, input_depth, input_width);
|
|
||||||
return network;
|
return network;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,16 @@ void free_a_cube_input_layer(Network* network, int pos, int depth, int dim) {
|
|||||||
gree(network->input_z[pos], true);
|
gree(network->input_z[pos], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void free_a_cube_input_layer_without_z(Network* network, int pos, int depth, int dim) {
|
||||||
|
for (int i=0; i < depth; i++) {
|
||||||
|
for (int j=0; j < dim; j++) {
|
||||||
|
gree(network->input[pos][i][j], true);
|
||||||
|
}
|
||||||
|
gree(network->input[pos][i], true);
|
||||||
|
}
|
||||||
|
gree(network->input[pos], true);
|
||||||
|
}
|
||||||
|
|
||||||
void free_a_line_input_layer(Network* network, int pos) {
|
void free_a_line_input_layer(Network* network, int pos) {
|
||||||
// Libère l'espace mémoire de network->input[pos] et network->input_z[pos]
|
// Libère l'espace mémoire de network->input[pos] et network->input_z[pos]
|
||||||
// lorsque ces couches sont denses (donc sont des matrice de dimension 1)
|
// lorsque ces couches sont denses (donc sont des matrice de dimension 1)
|
||||||
@ -97,7 +107,7 @@ void free_dense_linearisation(Network* network, int pos) {
|
|||||||
|
|
||||||
void free_network_creation(Network* network) {
|
void free_network_creation(Network* network) {
|
||||||
// On libère l'input correspondant à l'image: input[0] (car elle n'appartient à aucune couche)
|
// On libère l'input correspondant à l'image: input[0] (car elle n'appartient à aucune couche)
|
||||||
free_a_cube_input_layer(network, 0, network->depth[0], network->width[0]);
|
free_a_cube_input_layer_without_z(network, 0, network->depth[0], network->width[0]);
|
||||||
|
|
||||||
for (int i=0; i < network->max_size-1; i++) {
|
for (int i=0; i < network->max_size-1; i++) {
|
||||||
gree(network->kernel[i], true);
|
gree(network->kernel[i], true);
|
||||||
|
@ -10,6 +10,13 @@
|
|||||||
*/
|
*/
|
||||||
void free_a_cube_input_layer(Network* network, int pos, int depth, int dim);
|
void free_a_cube_input_layer(Network* network, int pos, int depth, int dim);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Libère l'espace mémoire de network->input[pos]
|
||||||
|
* lorsque cette couches est non denses (donc est une matrice de dimension 3)
|
||||||
|
* Libère donc l'espace mémoire alloué dans 'create_a_cube_input_layer' (creation.c)
|
||||||
|
*/
|
||||||
|
void free_a_cube_input_layer_without_z(Network* network, int pos, int depth, int dim);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Libère l'espace mémoire de network->input[pos] et network->input_z[pos]
|
* Libère l'espace mémoire de network->input[pos] et network->input_z[pos]
|
||||||
* lorsque ces couches sont denses (donc sont des matrice de dimension 1)
|
* lorsque ces couches sont denses (donc sont des matrice de dimension 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user