SavedModelBundle

public class SavedModelBundle

SavedModelBundle represents a model loaded from storage.

The model consists of a description of the computation (a Graph), a Session with tensors (e.g., parameters or variables in the graph) initialized to values saved in storage, and a description of the model (a serialized representation of a MetaGraphDef protocol buffer).

Nested Classes

class SavedModelBundle.Loader Options for loading a SavedModel. 

Public Methods

void
close()
Releases resources (the Graph and Session) associated with the saved model bundle.
Graph
graph()
Returns the graph that describes the computation performed by the model.
static SavedModelBundle
load(String exportDir, String... tags)
Load a saved model from an export directory.
static SavedModelBundle.Loader
loader(String exportDir)
Load a saved model.
byte[]
metaGraphDef()
Returns the serialized MetaGraphDef protocol buffer associated with the saved model.
Session
session()
Returns the Session with which to perform computation using the model.

Inherited Methods

Public Methods

public void close ()

Releases resources (the Graph and Session) associated with the saved model bundle.

public Graph graph ()

Returns the graph that describes the computation performed by the model.

public static SavedModelBundle load (String exportDir, String... tags)

Load a saved model from an export directory. The model that is being loaded should be created using the Saved Model API.

This method is a shorthand for:

SavedModelBundle.loader().withTags(tags).load();
 

Parameters
exportDir the directory path containing a saved model.
tags the tags identifying the specific metagraphdef to load.
Returns
  • a bundle containing the graph and associated session.

public static SavedModelBundle.Loader loader (String exportDir)

Load a saved model.

Returns a Loader object that can set configuration options before actually loading the model,

Parameters
exportDir the directory path containing a saved model.

public byte[] metaGraphDef ()

Returns the serialized MetaGraphDef protocol buffer associated with the saved model.

public Session session ()

Returns the Session with which to perform computation using the model.

Returns
  • the initialized session