Electron microscopy
 
tf.saved_model.save()
- Python for Integrated Circuits -
- An Online Book -
Python for Integrated Circuits                                                                                   http://www.globalsino.com/ICs/        


Chapter/Index: Introduction | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | Appendix

=================================================================================

The comparison between tf.saved_model.save() and tf.keras.model.save() is:
          i) Their common properties:
              i.a) Both are used to save and load models during or after training. Two kinds of APIs for saving and loading a Keras model:
                   i.a.1) High-level (tf.keras.Model.save and tf.keras.models.load_model),
                   i.a.2) How-level (tf.saved_model.save and tf.saved_model.load).
              i.b) Both can be used to save the data as a graph. At this point, there is almost no difference.
              i.c) Both take the same argument.
          ii) tf.keras.model.save:
              ii.a) It is .h5 format.
              ii.b) It can be used to save a Keras model in the saved_model format.
          iii) tf.saved_model.save:
              iii.a) It is more generic.
              iii.b) It is a plain TensorFlow SavedModel and cannot directly be loaded into a keras model since it lacks a keras_metadata.pb file. You have to load it like a normal SavedModel and wrap it in a keras model.

saved_model is the universal serialization format for TensorFlow models.

          tf.saved_model.save(obj, export_dir, signatures=None, options=None)
where,
          saved_model -- Exports a model object to a SavedModel  format.
          obj -- A trackable object such as a trained keras model.
          export_dir -- The directory in which to write the saved_model.

          tf.keras.models.save_model(
          model,         
          filepath,
          overwrite=True,
          include_optimizer=True,
          save_format=None,
          signatures=None,
          options=None,
          save_traces=True,
          )

The save_traces parameter by default is set as True. When save_traces, applies to SavedModel format, is enabled, the SavedModel will store the function traces for each layer. This can be disabled, by setting as False, so that only the configs of each layer are stored. Disabling this will decrease serialization time and reduce file size; however, it requires that all custom layers/models implement a get_config() method.

Or, another code for this funciton is:

          tf.saved_model.save(model,
          export_dir,
          signatures,
          options)

============================================

         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         

 

 

 

 

 



















































 

 

 

 

 

=================================================================================