pplonski/keras2cpp

Compatible for python3 and new keras

GeorgeKAHChen opened this issue · 3 comments

Compatible for python3 and new keras

For some reason we found this program to change python, keras to cpp. However after we used, we found some problem for this program. On the one hand, there are some little problem on python2 to python3. On the other hand, some subject of the json file of new keras has been changed. And after test, finally, we build a new version on this site

https://github.com/KazukiAmakawa/keras2cpp

djsg commented

@KazukiAmakawa
Hi, I tried your package, and got one warning and one error:
/data/fitpu/py_vt/tutorial-env/lib/python3.5/site-packages/keras/engine/base_layer.py:1109: UserWarning: Update your Dense call to the Keras 2 API: Dense(kernel_regularizer=None, trainable=True, units=10, kernel_initializer="glorot_uniform", activation="linear", activity_regularizer=None, bias_regularizer=None, bias_constraint=None, use_bias=True, input_dim=None, kernel_constraint=None, name="dense_2")
return cls(**config)
Traceback (most recent call last):
File "dump_to_simple_cpp.py", line 48, in
fout.write(str(W.shape[0]) + ' ' + str(W.shape[1]) + ' ' + str(W.shape[2]) + ' ' + str(W.shape[3]) + ' ' + l['config']['padding'] + '\n')
KeyError: 'padding'

@KazukiAmakawa
Hi, I tried your package, and got one warning and one error:
/data/fitpu/py_vt/tutorial-env/lib/python3.5/site-packages/keras/engine/base_layer.py:1109: UserWarning: Update your Dense call to the Keras 2 API: Dense(kernel_regularizer=None, trainable=True, units=10, kernel_initializer="glorot_uniform", activation="linear", activity_regularizer=None, bias_regularizer=None, bias_constraint=None, use_bias=True, input_dim=None, kernel_constraint=None, name="dense_2")
return cls(**config)
Traceback (most recent call last):
File "dump_to_simple_cpp.py", line 48, in
fout.write(str(W.shape[0]) + ' ' + str(W.shape[1]) + ' ' + str(W.shape[2]) + ' ' + str(W.shape[3]) + ' ' + l['config']['padding'] + '\n')
KeyError: 'padding'

This implementation does not work with python3. See issue #41