I need to convert estimator exporter code from tensorflow 1.x to 2 and get rid of placeholders. Does somebody know how to do it correctly?
I already tried features = {'input': tf.compat.v1.placeholder(tf.float32, shape=(1, 224, 224, 3), name="input")} , but this did not work as I would expect
features = {'input': tf.placeholder(tf.float32, shape=(1, 224, 224, 3), name="input")}
input_fn = tf.estimator.export.build_raw_serving_input_receiver_fn(features, 1)
exported_model_path = estimator.export_savedmodel(args.model_dir, input_fn)
In case you have migrated to using keras models you can use this
# model is a compiled and trained keras model
tf.saved_model.save(model, export_dir)
It will export the keras model to the SavedModel format.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.