MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / save

Method save

tensorflow/python/keras/engine/network.py:1122–1171  ·  view source on GitHub ↗

Saves the model to Tensorflow SavedModel or a single HDF5 file. The savefile includes: - The model architecture, allowing to re-instantiate the model. - The model weights. - The state of the optimizer, allowing to resume training exactly where you left off.

(self,
           filepath,
           overwrite=True,
           include_optimizer=True,
           save_format=None,
           signatures=None)

Source from the content-addressed store, hash-verified

1120 return model
1121
1122 def save(self,
1123 filepath,
1124 overwrite=True,
1125 include_optimizer=True,
1126 save_format=None,
1127 signatures=None):
1128 """Saves the model to Tensorflow SavedModel or a single HDF5 file.
1129
1130 The savefile includes:
1131 - The model architecture, allowing to re-instantiate the model.
1132 - The model weights.
1133 - The state of the optimizer, allowing to resume training
1134 exactly where you left off.
1135
1136 This allows you to save the entirety of the state of a model
1137 in a single file.
1138
1139 Saved models can be reinstantiated via `keras.models.load_model`.
1140 The model returned by `load_model`
1141 is a compiled model ready to be used (unless the saved model
1142 was never compiled in the first place).
1143
1144 Arguments:
1145 filepath: String, path to SavedModel or H5 file to save the model.
1146 overwrite: Whether to silently overwrite any existing file at the
1147 target location, or provide the user with a manual prompt.
1148 include_optimizer: If True, save optimizer's state together.
1149 save_format: Either 'tf' or 'h5', indicating whether to save the model
1150 to Tensorflow SavedModel or HDF5. The default is currently 'h5', but
1151 will switch to 'tf' in TensorFlow 2.0. The 'tf' option is currently
1152 disabled (use `tf.keras.experimental.export_saved_model` instead).
1153 signatures: Signatures to save with the SavedModel. Applicable to the 'tf'
1154 format only. Please see the `signatures` argument in
1155 `tf.saved_model.save` for details.
1156
1157 Example:
1158
1159 ```python
1160 from keras.models import load_model
1161
1162 model.save('my_model.h5') # creates a HDF5 file 'my_model.h5'
1163 del model # deletes the existing model
1164
1165 # returns a compiled model
1166 # identical to the previous one
1167 model = load_model('my_model.h5')
1168 ```
1169 """
1170 saving.save_model(self, filepath, overwrite, include_optimizer, save_format,
1171 signatures)
1172
1173 def save_weights(self, filepath, overwrite=True, save_format=None):
1174 """Saves all layer weights.

Callers 15

_save_modelMethod · 0.45
on_batch_endMethod · 0.45
on_epoch_endMethod · 0.45
on_train_endMethod · 0.45
save_weightsMethod · 0.45
export_saved_modelFunction · 0.45
_save_v1_formatFunction · 0.45
save_modelFunction · 0.45

Calls

no outgoing calls