This commit is contained in:
Timothée Menais 2022-07-27 10:34:00 +09:00 committed by GitHub
commit 6345ddea98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -481,6 +481,7 @@ typedef struct network{
float *truth;
float *delta;
float *workspace;
size_t workspace_size;
int train;
int index;
float *cost;

View File

@ -726,6 +726,17 @@ void free_network(network *net)
if(net->input_gpu) cuda_free(net->input_gpu);
if(net->truth_gpu) cuda_free(net->truth_gpu);
#endif
if(net->workspace_size){
#ifdef GPU
if(net->gpu_index >= 0){
cuda_free(net->workspace);
}else {
free(net->workspace);
}
#else
{free(net->workspace);}
#endif
}
free(net);
}