load_savedmodel: Load a SavedModel

Description Usage Arguments Details See Also Examples

Description

Loads a SavedModel using the given TensorFlow session and returns the model's graph.

Usage

1
load_savedmodel(sess = NULL, model_dir = NULL)

Arguments

sess

The TensorFlow session. NULL if using Eager execution.

model_dir

The path to the exported model, as a string. Defaults to a "savedmodel" path or the latest training run.

Details

Loading a model improves performance over multiple predict_savedmodel() calls.

See Also

export_savedmodel(), predict_savedmodel()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## 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()

## End(Not run)

tfdeploy documentation built on June 14, 2019, 5:04 p.m.