Reputation: 11
I am testing a simple model with the main to serving it . I am in colab environment. executing the code
import numpy as np
from tensorflow import keras
model=tf.keras.Sequential([keras.layers.Dense(units=1,input_shape=[1])])
model.compile(optimizer='sgd', loss='mean_squared_error')
xs=np.array([-1.0,0.0,1.0,2.0,3.0,4.0],dtype=float)
ys=np.array([-3.0,-1.0,1.0,3.0,5.0,7.0],dtype=float)
model.fit(xs,ys,epochs=500,verbose=2)
tf.saved_model.simple_save(
keras.backend.get_session(),
export_path,
inputs={'input_image': model.input},
outputs={t.name:t for t in model.outputs})
I obtain the following error that I don't know how to fix:
<ipython-input-19-634675006b49> in <module>()
----> 1 tf.saved_model.simple_save(
2 keras.backend.get_session(),
3 export_path,
4 inputs={'input_image': model.input},
5 outputs={t.name:t for t in model.outputs})
AttributeError: module 'tensorflow._api.v2.saved_model' has no attribute 'simple_save'```
Upvotes: 1
Views: 2855
Reputation: 452
simple_save
is deprecated in tensorflow v2 (LINK).
Try to use model.save(saving/path)
instead
full documentation on model.save : https://www.tensorflow.org/tutorials/keras/save_and_load#save_the_entire_model
Upvotes: 2