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

terminate called after throwing an instance of 'std::bad_alloc' #38

Closed muhac closed 6 years ago

muhac commented 6 years ago

Test, step 3 Compile keras2cpp code Run predictions with dumped network and random data sample from step 2 Testing network from test_cnn.dumped on data from test_random_input.dat terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc

I'm using it on win10 and i got this when trying to run test_bin. What should i do?

# TypeError: softmax() got an unexpected keyword argument 'axis'
# Keras Version 2.1.6
#
# terminate called after throwing an instance of 'std::bad_alloc'
#   what():  std::bad_alloc
# Keras Version 2.0.1 -2.1.5
#
# TypeError: ('Keyword argument not understood:', 'input_dtype')
# collect2.exe: error: ld returned 1 exit status
# DataChunk2D 0x
# Keras Version 2.0.0
muhac commented 6 years ago

Okay, I solved this on version 1.2.2 however,

Compare Keras and Keras2cpp outputs
[0.06040447 0.11201825 0.08582997 0.09471637 0.06019132 0.08795022
 0.05853335 0.18006188 0.15990695 0.10038719]
[0.0631625 0.092902  0.0489044 0.0912403 0.0523701 0.128736  0.0515021
 0.180591  0.192843  0.0977486]
Test: [ERROR]
The output from Keras and Keras2cpp are different.
Difference value: 0.15401792799999997
Cleaning after test

Is that normal?

pplonski commented 6 years ago

please try with theano backend

muhac commented 6 years ago

Thanks a lot. It works fine now on version 1.1.x