I ran the code
export_path=os.getcwd()+'\\model\\'+'2016'
with tf.Session(graph=tf.Graph()) as sess:
tf.saved_model.loader.load(sess, ["myTag"], export_path)
graph = tf.get_default_graph()
# print(graph.get_operations())
input = graph.get_tensor_by_name('input:0')
output = graph.get_tensor_by_name('output:0')
# print(sess.run(output,
# feed_dict={input: [test_data[1]]}))
tf.train.write_graph(freeze_session(sess), export_path, "my_model.pb", as_text=False)
and incurred the following error
OSError Traceback (most recent call last)
<ipython-input-44-b154e11ca364> in <module>()
3
4 with tf.Session(graph=tf.Graph()) as sess:
----> 5 tf.saved_model.loader.load(sess, ["myTag"], export_path)
6 graph = tf.get_default_graph()
7 # print(graph.get_operations())
3 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/saved_model/loader_impl.py in parse_saved_model(export_dir)
81 (export_dir,
82 constants.SAVED_MODEL_FILENAME_PBTXT,
---> 83 constants.SAVED_MODEL_FILENAME_PB))
84
85
OSError: SavedModel file does not exist at: /content\model\2016/{saved_model.pbtxt|saved_model.pb}
It was previously ran in Windows system and now IOS. I am not sure if it was because of this. Any help is appreciated. Thank you.
You should avoid using a fixed character as directory separator (like \
in your example), as that character differs between operating systems (see os.sep).
You might want to use os.path.join or Path to build your path, thereby ensuring suitable paths for the executing operating system are created, e.g.:
export_path = os.path.join(os.getcwd(), 'model', '2016')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With