Adds value
to the collection with name key
.
Adds value
to the collection with name key
.
Value to add to the collection.
Collection name.
Asserts that this graph has not been frozen.
Asserts that this graph has not been frozen.
TODO: !!!
TODO: !!!
Removes the specified collection from this graph.
Releases the native resources associated with this object.
Releases the native resources associated with this object.
Freezes this graph, meaning that no more ops can be added to it after a call to this function.
Freezes this graph, meaning that no more ops can be added to it after a call to this function. This method is used to ensure that no operations are added to a graph when it is shared between multiple threads.
Gets the set of values contained in the collection with name key
.
Gets the set of values contained in the collection with name key
.
Note that this method returns an immutable copy of the set.
Collection name.
Set of values contained in the collection with name collection
.
Returns the op referred to by the provided name, in this graph.
Returns the op referred to by the provided name, in this graph.
If such an op cannot be found, an informative exception is thrown.
Op name.
Op, from this graph, corresponding to that name.
InvalidArgumentException
If the provided name cannot be associated with an element of this graph.
This function may be called concurrently from multiple threads (i.e., it is thread-safe).
Returns the op output referred to by the provided name, in this graph.
Returns the op output referred to by the provided name, in this graph.
If such an op output cannot be found, an informative exception is thrown.
Op output name.
Op output, from this graph, corresponding to that name.
InvalidArgumentException
If the provided name cannot be associated with an element of this graph.
This function may be called concurrently from multiple threads (i.e., it is thread-safe).
Returns the set of global variables in this graph.
Returns the set of global variables in this graph.
Global variables are variables that are shared across machines in a distributed environment. The Variable()
constructor and the function getVariable()
automatically add new variables to the graph collection with key
Graph.Keys.GLOBAL_VARIABLES
. This convenience function returns the contents of that collection.
An alternative to global variables are local variables.
Returns an op that initializes all global variables of this graph.
Returns an op that initializes all global variables of this graph.
For more information, refer to globalVariables and Variable.initializer.
Name for the created op.
Created op.
Imports a serialized representation of a graph into the current graph.
Imports a serialized representation of a graph into the current graph.
Serialized representation of the graph that will be imported into this graph.
Optional prefix that will be prepended to all node names in the graph that is being imported to this graph.
Optional inputs mapping. For each
(source_op_name, source_op_output_index) -> destination_op_output
mapping, the
importer will set any imported nodes with input named
source_op_name:source_op_output_index
to have that input replaced with
destination_op_output
. source_op_name
refers to a node in the graph to be
imported, whereas destination_op_output
references a node already existing in
this graph.
Optional control dependencies mapping. For each source_op_name -> destination_op
mapping, the importer will set any imported ops with control input named
source_op_name
to have that input replaced with destination_op
.
source_op_name
refers to a node in the graph to be imported, whereas
destination_op
references an op already existing in this graph.
Optional control dependencies set. The importer will make sure that the imported graph has a control dependency on all ops in this set. All such ops, should therefore be defined in this graph.
Imports a serialized representation of a graph and its meta-information into the current graph.
Imports a serialized representation of a graph and its meta-information into the current graph.
This function takes a MetaGraphDef protocol buffer as input and it adds all the nodes from its graph_def
field to the current graph. It also recreates the desired collections stored in that protocol buffer.
In combination with toMetaGraphDef, this function can be used to:
Serialized representation of the graph and its meta-information, that will be imported into this graph.
Optional prefix that will be prepended to all node names in the graph that is being imported to this graph.
Optional inputs mapping. For each
(source_op_name, source_op_output_index) -> destination_op_output
mapping,
the importer will set any imported nodes with input named
source_op_name:source_op_output_index
to have that input replaced with
destination_op_output
. source_op_name
refers to a node in the graph to be
imported, whereas destination_op_output
references a node already existing
in this graph.
Optional control dependencies mapping. For each
source_op_name -> destination_op
mapping, the importer will set any imported
ops with control input named source_op_name
to have that input replaced with
destination_op
. source_op_name
refers to a node in the graph to be
imported, whereas destination_op
references an op already existing in this
graph.
Optional control dependencies set. The importer will make sure that the imported graph has a control dependency on all ops in this set. All such ops, should therefore be defined in this graph.
Boolean value indicating whether to clear the device information from the returned node definition.
Collection key for looking up unbound inputs.
Function that takes as input a graph collection key and returns a boolean
value indicating whether or not to load that collection. Note that the
collection specified by unboundInputsCollectionKey
is never loaded.
Defaults to a function that returns true
for all inputs.
Returns true
if this graph has been closed (meaning that the corresponding native object has been deleted).
Returns true
if this graph has been closed (meaning that the corresponding native object has been deleted).
Returns a boolean flag indicating whether this graph has been frozen (i.e., no more ops can be added to it).
Returns a boolean flag indicating whether this graph has been frozen (i.e., no more ops can be added to it).
Returns the set of all local resources used by the graph which need to be initialized once per cluster.
Returns the set of all local resources used by the graph which need to be initialized once per cluster.
Returns the set of local variables in this graph.
Returns the set of local variables in this graph.
Local variables (or per-process variables), are usually not saved/restored to/from checkpoints and are used for temporary or intermediate values. For example, they can be used as counters for metrics computations or number of epochs this machine has read data. This convenience function returns the contents of that collection.
An alternative to local variables are global variables.
Returns an op that initializes all local variables of this graph.
Returns an op that initializes all local variables of this graph.
For more information, refer to localVariables and Variable.initializer.
Name for the created op.
Created op.
Returns the set of metric variables in the current graph.
Returns the set of metric variables in the current graph.
Metric variables are usually not saved/restored to/from checkpoints and are used for temporary or intermediate values used for computing metrics (e.g., streaming metrics). This convenience function returns the contents of that collection.
Returns an op that initializes all metric variables of this graph.
Returns an op that initializes all metric variables of this graph.
For more information, refer to metricVariables and Variable.initializer.
Name for the created op.
Created op.
Returns the subset of Variable
objects that are used in models for inference (feed forward), in this graph.
Returns the subset of Variable
objects that are used in models for inference (feed forward), in this graph.
Returns an op that initializes all model variables of this graph.
Returns an op that initializes all model variables of this graph.
For more information, refer to modelVariables and Variable.initializer.
Name for the created op.
Created op.
Returns all ops of this graph.
Returns all ops of this graph.
Array containing all ops of this graph.
This function may be called concurrently from multiple threads (i.e., it is thread-safe).
Graph used during construction of this graph.
Gets the random seed of this graph.
Gets the random seed of this graph.
Returns the set of all savers that have been created in the graph.
Returns the set of all savers that have been created in the graph.
Sets the random seed of this graph to the provided value.
Sets the random seed of this graph to the provided value.
Returns the set of all shared resources used by the graph which need to be initialized once per cluster.
Returns the set of all shared resources used by the graph which need to be initialized once per cluster.
Returns the set of all the summary Output
s that have been created in the graph.
Returns the set of all the summary Output
s that have been created in the graph.
Returns the set of all the table initializers that have been created in the graph.
Returns the set of all the table initializers that have been created in the graph.
Constructs and returns a GraphDef object, which is a serialized version of this graph.
Constructs and returns a GraphDef object, which is a serialized version of this graph.
Note that the GraphDef does not contain any meta-information about the graph (such as collections information, for example). For a serialized representation of the graph that contains such information, please refer to Graph.toMetaGraphDef.
Constructs and returns a MetaGraphDef object using the provided arguments.
Constructs and returns a MetaGraphDef object using the provided arguments.
In combination with importMetaGraphDef, this function can be used to:
Optional string specifying the name scope to remove. Only the ops within this name scope will be included in the resulting ProtoBuf object and the export scope will be stripped from their names to allow for easy import into new name scopes.
MetaInfoDef associated with the MetaGraphDef that will be constructed.
SaverDef associated with the MetaGraphDef that will be constructed.
Graph collection keys specifying the collections to include in the MetaGraphDef.
Collection key for storing unbound inputs. If provided, a string collection with the given name will be added to the returned MetaGraphDef, containing the names of tensors that must be remapped when importing the MetaGraphDef.
Boolean value indicating whether to clear the device information from the returned node definitions.
Constructed MetaGraphDef.
Constructs and returns a GraphDef object, which is a serialized version of this graph.
Constructs and returns a GraphDef object, which is a serialized version of this graph.
Note that the GraphDef does not contain any meta-information about the graph (such as collections information, for example). For a serialized representation of the graph that contains such information, please refer to Graph.toMetaGraphDef.
ProtoBuf object corresponding to this object.
Returns the set of all the train Op
s (i.e., optimizer update ops) that have been created in the graph.
Returns the set of all the train Op
s (i.e., optimizer update ops) that have been created in the graph.
Returns the set of all variables created with trainable = true
.
Returns the set of all variables created with trainable = true
.
When passed trainable = true
, the Variable()
constructor automatically adds new variables to the graph
collection with key Graph.Keys.TRAINABLE_VARIABLES
. This convenience function returns the contents of that
collection.
Returns an op that initializes all trainable variables of this graph.
Returns an op that initializes all trainable variables of this graph.
For more information, refer to trainableVariables and Variable.initializer.
Name for the created op.
Created op.
Unfreezes this graph.
Unfreezes this graph.
Creates an op that returns a tensor containing the names of all uninitialized resources among all shared and local resources of this graph.
Creates an op that returns a tensor containing the names of all uninitialized resources among all shared and local resources of this graph. If all resources have been initialized, then an empty tensor is returned.
Name for the created op.
Created op output, which contains the names of the handles of all resources which have not yet been initialized.
Creates an op that returns a tensor containing the names of all uninitialized variables among all global and local variables of this graph.
Creates an op that returns a tensor containing the names of all uninitialized variables among all global and local variables of this graph. If all variables have been initialized, then an empty tensor is returned.
Name for the created op.
Created op output, which contains the names of the handles of all variables which have not yet been initialized.
Graph extension helper for constructing a function.
A FunctionGraph keeps track of all inputs into every op created inside it. If any input is from another graph, we keep track of it and substitute the input with a placeholder.
Each captured input's corresponding placeholder is converted into a function argument and the caller passes in the captured tensor.