serizba / cppflow

Run TensorFlow models in C++ without installation and without Bazel
https://serizba.github.io/cppflow/
MIT License
774 stars 177 forks source link

Loading h5 models #219

Open Psyhich opened 1 year ago

Psyhich commented 1 year ago

Hi, I'm trying to use your library to load model in h5 format, but it's maybe ill formed or just not possible. I've created model using such python code:

stacked = tf.keras.layers.StackedRNNCells(\
    [tf.keras.layers.LSTMCell(lstm_count) for _ in range(lstm_layers_count)])

model = tf.keras.Sequential([
    tf.keras.layers.RNN(stacked),
    tf.keras.layers.Dense(outpust_count)
])

And I cannot save it in other formats because I will not be able to use functions of this model. So my question is it possible to load such model using your library or I should look for something else?

yochananscharf commented 1 year ago

Save the model in the saved_model format. This can be done by doing model.save("model_name"). Tensorflow will save the model in the saved_model format if you don't put .h5 in "model_name".