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).

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.
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.

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 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