Difference of tensor flows between the saving model through the exporter and tf.train.write_graph ()?

What is the difference between saving a model with

  • using the exporter as specified in tensorflow application:

eg:

from tensorflow.contrib.session_bundle import exporter #from tensorflow_serving.session_bundle import exporter saver = tf.train.Saver(sharded=True) model_exporter = exporter.Exporter(saver) model_exporter.init( sess.graph.as_graph_def(), named_graph_signatures={ 'inputs': exporter.generic_signature({'images': x}), 'outputs': exporter.generic_signature({'scores': y})}) model_exporter.export(export_path, tf.constant(FLAGS.export_version), sess) 
  1. Using tf.train.write_graph () and tf.train.Saver () directly:

eg:

 with sess.graph.as_default(): saver = tf.train.Saver() saver.save(sess, path, meta_graph_suffix='meta', write_meta_graph=True) 

The question is a continuation of Saving TensorFlow in / loading a graph from a file

+5
source share
2 answers

Given that Exporter is now officially obsolete, a new protocol for saving graphics and data is to use Saver. Here is a great blog with sample code: https://blog.metaflow.fr/tensorflow-how-to-freeze-a-model-and-serve-it-with-a-python-api-d4f3596b3adc .

+1
source

The exporter is used after you train the model and want to service it (use it for output).

Saver is used for verification during model preparation.

0
source

Source: https://habr.com/ru/post/1263047/


All Articles