Class/Object

org.platanios.tensorflow.api.ops

FunctionGraph

Related Docs: object FunctionGraph | package ops

Permalink

class FunctionGraph extends core.Graph

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.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. FunctionGraph
  2. Graph
  3. Serializable
  4. Closeable
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new FunctionGraph(nativeHandleWrapper: NativeHandleWrapper, captureByValue: Boolean, closeFn: () ⇒ Unit)

    Permalink

    captureByValue

    TODO: !!!

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addOpAndParents(op: Op): Op

    Permalink
    Attributes
    protected
  5. def addOutputAndParents(output: Output): Output

    Permalink
    Attributes
    protected
  6. def addToCollection[K](value: K, key: Key[K]): Unit

    Permalink

    Adds value to the collection with name key.

    Adds value to the collection with name key.

    value

    Value to add to the collection.

    key

    Collection name.

    Definition Classes
    Graph
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def assertNotFrozen(): Unit

    Permalink

    Asserts that this graph has not been frozen.

    Asserts that this graph has not been frozen.

    Definition Classes
    Graph
    Annotations
    @throws( ... )
  9. val captureByValue: Boolean

    Permalink

    TODO: !!!

    TODO: !!!

    Attributes
    protected
  10. def clearCollection[K](key: Key[K]): Unit

    Permalink

    Removes the specified collection from this graph.

    Removes the specified collection from this graph.

    key

    Collection key.

    Definition Classes
    Graph
  11. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. def close(): Unit

    Permalink

    Releases the native resources associated with this object.

    Releases the native resources associated with this object.

    Definition Classes
    Closeable
  13. val closeFn: () ⇒ Unit

    Permalink
    Attributes
    protected
    Definition Classes
    FunctionGraphGraphCloseable
  14. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. def equals(that: Any): Boolean

    Permalink
    Definition Classes
    Graph → AnyRef → Any
  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. def freeze(): Unit

    Permalink

    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.

    Definition Classes
    Graph
  18. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  19. def getCollection[K](key: Key[K]): Set[K]

    Permalink

    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.

    key

    Collection name.

    returns

    Set of values contained in the collection with name collection.

    Definition Classes
    Graph
  20. def getOpByName(name: String): Op

    Permalink

    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.

    name

    Op name.

    returns

    Op, from this graph, corresponding to that name.

    Definition Classes
    Graph
    Annotations
    @throws( ... )
    Exceptions thrown

    InvalidArgumentException If the provided name cannot be associated with an element of this graph.

    Note

    This function may be called concurrently from multiple threads (i.e., it is thread-safe).

  21. def getOutputByName(name: String): Output

    Permalink

    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.

    name

    Op output name.

    returns

    Op output, from this graph, corresponding to that name.

    Definition Classes
    Graph
    Annotations
    @throws( ... )
    Exceptions thrown

    InvalidArgumentException If the provided name cannot be associated with an element of this graph.

    Note

    This function may be called concurrently from multiple threads (i.e., it is thread-safe).

  22. def globalVariables: Set[variables.Variable]

    Permalink

    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.

    Definition Classes
    Graph
  23. def globalVariablesInitializer(name: String = "GlobalVariablesInitializer"): Op

    Permalink

    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

    Name for the created op.

    returns

    Created op.

    Definition Classes
    Graph
  24. def hashCode(): Int

    Permalink
    Definition Classes
    Graph → AnyRef → Any
  25. def importGraphDef(graphDef: GraphDef, importScope: String = null, inputsMap: Map[(String, Int), Output] = Map.empty, controlDependenciesMap: Map[String, Op] = Map.empty, controlDependencies: Set[Op] = Set.empty): Unit

    Permalink

    Imports a serialized representation of a graph into the current graph.

    Imports a serialized representation of a graph into the current graph.

    graphDef

    Serialized representation of the graph that will be imported into this graph.

    importScope

    Optional prefix that will be prepended to all node names in the graph that is being imported to this graph.

    inputsMap

    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.

    controlDependenciesMap

    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.

    controlDependencies

    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.

    Definition Classes
    Graph
  26. def importMetaGraphDef(metaGraphDef: MetaGraphDef, importScope: String = null, inputsMap: Map[(String, Int), Output] = Map.empty, controlDependenciesMap: Map[String, Op] = Map.empty, controlDependencies: Set[Op] = Set.empty, clearDevices: Boolean = false, unboundInputsCollectionKey: Key[String] = Graph.Keys.UNBOUND_INPUTS, restoreCollectionsPredicate: (Key[_]) ⇒ Boolean = _ => true): Unit

    Permalink

    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:

    • Serialize a graph along with other objects stored in its collections, into a MetaGraphDef.
    • Restart training from saved graphs and checkpoints.
    • Run inference from saved graphs and checkpoints.
    metaGraphDef

    Serialized representation of the graph and its meta-information, that will be imported into this graph.

    importScope

    Optional prefix that will be prepended to all node names in the graph that is being imported to this graph.

    inputsMap

    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.

    controlDependenciesMap

    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.

    controlDependencies

    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.

    clearDevices

    Boolean value indicating whether to clear the device information from the returned node definition.

    unboundInputsCollectionKey

    Collection key for looking up unbound inputs.

    restoreCollectionsPredicate

    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.

    Definition Classes
    Graph
  27. def isClosed: Boolean

    Permalink

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

    Definition Classes
    Graph
  28. def isFrozen: Boolean

    Permalink

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

    Definition Classes
    Graph
  29. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  30. def localResources: Set[Resource]

    Permalink

    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.

    Definition Classes
    Graph
  31. def localVariables: Set[variables.Variable]

    Permalink

    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.

    Definition Classes
    Graph
  32. def localVariablesInitializer(name: String = "LocalVariablesInitializer"): Op

    Permalink

    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

    Name for the created op.

    returns

    Created op.

    Definition Classes
    Graph
  33. def metricVariables: Set[variables.Variable]

    Permalink

    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.

    Definition Classes
    Graph
  34. def metricVariablesInitializer(name: String = "MetricVariablesInitializer"): Op

    Permalink

    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

    Name for the created op.

    returns

    Created op.

    Definition Classes
    Graph
  35. def modelVariables: Set[variables.Variable]

    Permalink

    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.

    Definition Classes
    Graph
  36. def modelVariablesInitializer(name: String = "ModelVariablesInitializer"): Op

    Permalink

    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

    Name for the created op.

    returns

    Created op.

    Definition Classes
    Graph
  37. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  38. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  39. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  40. def ops: Array[Op]

    Permalink

    Returns all ops of this graph.

    Returns all ops of this graph.

    returns

    Array containing all ops of this graph.

    Definition Classes
    Graph
    Note

    This function may be called concurrently from multiple threads (i.e., it is thread-safe).

  41. val outerGraph: core.Graph

    Permalink

    Graph used during construction of this graph.

  42. def randomSeed: Option[Int]

    Permalink

    Gets the random seed of this graph.

    Gets the random seed of this graph.

    Definition Classes
    Graph
  43. def savers: Set[Saver]

    Permalink

    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.

    Definition Classes
    Graph
  44. def setRandomSeed(value: Int): Unit

    Permalink

    Sets the random seed of this graph to the provided value.

    Sets the random seed of this graph to the provided value.

    Definition Classes
    Graph
  45. def sharedResources: Set[Resource]

    Permalink

    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.

    Definition Classes
    Graph
  46. def summaries: Set[Output]

    Permalink

    Returns the set of all the summary Outputs that have been created in the graph.

    Returns the set of all the summary Outputs that have been created in the graph.

    Definition Classes
    Graph
  47. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  48. def tableInitializers: Set[Op]

    Permalink

    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.

    Definition Classes
    Graph
  49. def toGraphDef: GraphDef

    Permalink

    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.

    Definition Classes
    Graph
  50. def toMetaGraphDef(exportScope: String = null, metaInfoDef: MetaInfoDef = null, saverDef: SaverDef = null, collections: Set[Key[_]] = Set.empty, unboundInputsCollectionKey: Key[String] = Graph.Keys.UNBOUND_INPUTS, clearDevices: Boolean = false): MetaGraphDef

    Permalink

    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:

    • Serialize a graph along with other objects stored in its collections, into a MetaGraphDef.
    • Restart training from saved graphs and checkpoints.
    • Run inference from saved graphs and checkpoints.
    exportScope

    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

    MetaInfoDef associated with the MetaGraphDef that will be constructed.

    saverDef

    SaverDef associated with the MetaGraphDef that will be constructed.

    collections

    Graph collection keys specifying the collections to include in the MetaGraphDef.

    unboundInputsCollectionKey

    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.

    clearDevices

    Boolean value indicating whether to clear the device information from the returned node definitions.

    returns

    Constructed MetaGraphDef.

    Definition Classes
    Graph
  51. def toProto: GraphDef

    Permalink

    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.

    returns

    ProtoBuf object corresponding to this object.

    Definition Classes
    GraphSerializable
  52. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  53. def trainOps: Set[Op]

    Permalink

    Returns the set of all the train Ops (i.e., optimizer update ops) that have been created in the graph.

    Returns the set of all the train Ops (i.e., optimizer update ops) that have been created in the graph.

    Definition Classes
    Graph
  54. def trainableVariables: Set[variables.Variable]

    Permalink

    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.

    Definition Classes
    Graph
  55. def trainableVariablesInitializer(name: String = "TrainableVariablesInitializer"): Op

    Permalink

    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

    Name for the created op.

    returns

    Created op.

    Definition Classes
    Graph
  56. def unFreeze(): Unit

    Permalink

    Unfreezes this graph.

    Unfreezes this graph.

    Definition Classes
    Graph
  57. def uninitializedResources(name: String = "UninitializedResources"): Output

    Permalink

    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

    Name for the created op.

    returns

    Created op output, which contains the names of the handles of all resources which have not yet been initialized.

    Definition Classes
    Graph
  58. def uninitializedVariables(name: String = "UninitializedVariables"): Output

    Permalink

    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

    Name for the created op.

    returns

    Created op output, which contains the names of the handles of all variables which have not yet been initialized.

    Definition Classes
    Graph
  59. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  60. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  61. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from core.Graph

Inherited from Serializable

Inherited from utilities.Closeable

Inherited from AnyRef

Inherited from Any

Ungrouped