pplonski / keras2cpp

This is a bunch of code to port Keras neural network model into pure C++.
MIT License
679 stars 153 forks source link

Compute_output and memory management #8

Closed falvaro closed 7 years ago

falvaro commented 7 years ago

When computing the output of a model with KerasModel::compute_output(keras::DataChunk *dc) the input DataChunk (dc) is deleted. Since this DataChunk is created somewhere else, I think it is better to let the code that created the object to free it. To do this, a single line should be added to the code to prevent this first input to be deleted, here.

Add a condition to delete inp; like if( inp != dc ) delete inp;

pplonski commented 7 years ago

Thanks! I have changed this and now input DataChunk is deleted in main function. Thanks!