How to use a saved tensorflow model?

Hi,

I followed this tutorial here to create a dnn multi variable model and have saved it as the tutorial specifies (dnn_model.save('dnn_model')). However, it wasn’t really clear to me how I can use the model later. For example, I have a new set of input data that I would like to predict for using my model, but how would I run this on tensorflow?

I also saw this tutorial here which had a section on “using the model” but I wasn’t sure how to do this with a multi variable dnn. Apologies if this is a basic question, I just started using tensorflow.

Any help would be much appreciated!

Have you tried following the save and load tutorial?

I’ve had trouble with using model.save and tf.keras.models.load_model and have had better luck with:

tf.saved_model.save(model, path)
...
loaded_model = tf.saved_model.load(path)

Once you load the model, you may use the model to make predictions just as you would before saving it.

predictions = loaded_model.predict(input)