Loads a SavedModel using the given TensorFlow session and returns the model's graph.
load_savedmodel(sess, model_dir = NULL)
sess | The TensorFlow session. |
---|---|
model_dir | The path to the exported model, as a string. Defaults to a "savedmodel" path or the latest training run. |
Loading a model improves performance over multiple predict_savedmodel()
calls.
export_savedmodel()
, predict_savedmodel()
# NOT RUN { # start session sess <- tensorflow::tf$Session() # preload an existing model into a TensorFlow session graph <- tfdeploy::load_savedmodel( sess, system.file("models/tensorflow-mnist", package = "tfdeploy") ) # perform prediction based on a pre-loaded model tfdeploy::predict_savedmodel( list(rep(9, 784)), graph ) # close session sess$close() # }