restore model or session from file
save model or session to file
string; path to saved state
(optional) equations of the form format=name
format=one of auto, checkpoint, checkpoint[legacy], hdf5, json, or savedmodel
Specifies the file format to use when saving. Note that all formats other than checkpoint[legacy] require that a Model object be supplied as an argument to Save.
checkpoint is a TensorFlow training checkpoint file. Currently this is identical to checkpoint[legacy] but a future version may support TensorFlow version 2 checkpoint files.
checkpoint[legacy] is a TensorFlow version 1 checkpoint file.
hd5 is an HDF5 (Hierarchical Data Format) file.
json is a JSON file.
savedmodel is a TensorFlow Keras SavedModel file.
The default is auto, which attempts to infer the desired format from path and which falls back to savedmodel if no other format can be inferred.
Restore(path) command loads a saved Model or computation session to memory from a file or directory located at path. If path corresponds to a Model, a corresponding Model object is returned. If path corresponds to a session, its state is copied into the current session.
Save(path) command saves a Model or computation session in memory to a file or directory located at path.
These functions are part of the DeepLearning package, so they can be used in the short form Restore(..) and Save(..) only after executing the command with(DeepLearning). However, they can always be accessed through the long form of the command by using DeepLearning[Restore](..) or DeepLearning[Save](..).
For more information about saving models, see the TensorFlow Python API documentation for saved models.
Build a model and then save it to a directory in the SavedModel format.
data ≔ Import⁡datasets/pima-epidemiology-diabetes.csv,base=datadir1..600,..
model ≔ Sequential⁡DenseLayer⁡12,activation=relu,DenseLayer⁡8,activation=relu,DenseLayer⁡1,activation=sigmoid
model≔DeepLearning Model<keras.engine.sequential.Sequential object at 0x7f18c08147c0>
Save the previous model to a file in HDF5 format and restore from it.
Save the previous model to a file in JSON format and restore from it.
Save and restore a session in the legacy checkpoint (TensorFlow version 1) format.
v ≔ Variable⁡1.0,0.5,datatype=float8
c ≔ Constant⁡1.5,3.0,datatype=float8
sess ≔ GetDefaultSession⁡
The DeepLearning[Restore] and DeepLearning[Save] commands were introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
Download Help Document