Go to the documentation of this file.00001 #include "layer.h"
00002 #include "cuda.h"
00003 #include <stdlib.h>
00004
00005 void free_layer(layer l)
00006 {
00007 if(l.type == DROPOUT){
00008 if(l.rand) free(l.rand);
00009 #ifdef GPU
00010 if(l.rand_gpu) cuda_free(l.rand_gpu);
00011 #endif
00012 return;
00013 }
00014 if(l.indexes) free(l.indexes);
00015 if(l.rand) free(l.rand);
00016 if(l.cost) free(l.cost);
00017 if(l.biases) free(l.biases);
00018 if(l.bias_updates) free(l.bias_updates);
00019 if(l.weights) free(l.weights);
00020 if(l.weight_updates) free(l.weight_updates);
00021 if(l.col_image) free(l.col_image);
00022 if(l.input_layers) free(l.input_layers);
00023 if(l.input_sizes) free(l.input_sizes);
00024 if(l.delta) free(l.delta);
00025 if(l.output) free(l.output);
00026 if(l.squared) free(l.squared);
00027 if(l.norms) free(l.norms);
00028
00029 #ifdef GPU
00030 if(l.indexes_gpu) cuda_free((float *)l.indexes_gpu);
00031 if(l.weights_gpu) cuda_free(l.weights_gpu);
00032 if(l.weight_updates_gpu) cuda_free(l.weight_updates_gpu);
00033 if(l.col_image_gpu) cuda_free(l.col_image_gpu);
00034 if(l.weights_gpu) cuda_free(l.weights_gpu);
00035 if(l.biases_gpu) cuda_free(l.biases_gpu);
00036 if(l.weight_updates_gpu) cuda_free(l.weight_updates_gpu);
00037 if(l.bias_updates_gpu) cuda_free(l.bias_updates_gpu);
00038 if(l.output_gpu) cuda_free(l.output_gpu);
00039 if(l.delta_gpu) cuda_free(l.delta_gpu);
00040 if(l.rand_gpu) cuda_free(l.rand_gpu);
00041 if(l.squared_gpu) cuda_free(l.squared_gpu);
00042 if(l.norms_gpu) cuda_free(l.norms_gpu);
00043 #endif
00044 }