Class

org.platanios.tensorflow.api.learn

SessionWrapper

Related Doc: package learn

Permalink

class SessionWrapper extends core.client.Session

Wrapper around a Session that invokes Hook callbacks before and after calls to Session.run().

This wrapper is used as a base class for various session wrappers that provide additional functionality such as monitoring and recovery.

In addition to the methods provided by Session the wrapper provides a method to check for requested stops and never throws any exceptions thrown by calls to Session.close.

The list of hooks to call is passed in the constructor. Before each call to Session.run() the session calls the Hook.beforeSessionRun() method of each hook, which can return additional ops or tensors to run. These are added to the arguments of the call to Session.run().

When the Session.run() call finishes, the session invokes the Hook.afterSessionRun() method of each hook, passing the values returned by the Session.run() call corresponding to the ops and tensors that each hook requested.

If any call to the hooks requests a stop via the runContext, the session will be marked as needing to stop and its shouldStop() method will then return true.

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SessionWrapper
  2. Session
  3. Closeable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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. var _closed: Boolean

    Permalink
    Attributes
    protected
  5. var _hooksEnabled: Boolean

    Permalink
    Attributes
    protected
  6. var _shouldStop: Boolean

    Permalink
    Attributes
    protected
  7. val activeHooks: Set[Hook]

    Permalink
    Attributes
    protected
  8. def addHooks(hooks: Set[Hook]): Unit

    Permalink

    Adds the provided hooks to this session wrapper.

    Adds the provided hooks to this session wrapper. Note that the begin() method of these hooks may not be called given that they are added in an existing session and not provided in its constructor.

  9. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  10. def clone(): AnyRef

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

    Permalink

    Releases the native resources associated with this object.

    Releases the native resources associated with this object.

    Definition Classes
    SessionWrapperCloseable
  12. val closeFn: () ⇒ Unit

    Permalink

    Function used to delete the native server object (i.e., free relevant memory).

    Function used to delete the native server object (i.e., free relevant memory).

    Attributes
    protected
    Definition Classes
    SessionCloseable
  13. def closed: Boolean

    Permalink

    Returns a boolean flag indicating whether this session has been closed.

    Returns a boolean flag indicating whether this session has been closed.

    Definition Classes
    SessionWrapperSession
  14. def disableHooks(): Unit

    Permalink
  15. def enableHooks(): Unit

    Permalink
  16. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  20. val graph: core.Graph

    Permalink
    Definition Classes
    Session
  21. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  22. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  23. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  26. def removeHooks(hooks: Set[Hook]): Unit

    Permalink

    Removes the provided hooks from this session wrapper.

  27. def resetShouldStop(): Unit

    Permalink

    Resets the shouldStop flag of this session wrapper to false.

  28. def run[F, E, R](feeds: FeedMap = FeedMap.empty, fetches: F = Seq.empty[Output], targets: E = Traversable.empty[Op], options: Option[RunOptions] = None)(implicit executable: Executable[E], fetchable: Aux[F, R]): R

    Permalink

    Runs ops and evaluates tensors in fetches, and returns the values of the evaluated tensors.

    Runs ops and evaluates tensors in fetches, and returns the values of the evaluated tensors.

    This method runs one "step" of TensorFlow computation, by running the necessary graph fragment to execute every Op and evaluate every Output in fetches, substituting the values in feeds for the corresponding input values.

    feeds

    Optional feed map. This argument can be used to feed values into a TensorFlow session. It is a map from graph nodes to their corresponding Tensor values. More specifically, for all allowed types for this argument, please refer to the documentation of the Feedable type class.

    fetches

    Optional argument specifying which values to fetch from the TensorFlow session. This argument can have various forms and its type defines the return type of this function. Please refer to the documentation of the Fetchable type class for details on the allowed types.

    targets

    Optional argument specifying which ops to execute in the TensorFlow graph, without returning their value. Please refer to the documentation of the Executable type class for details on the allowed types of targets.

    options

    Optional RunOptions protocol buffer that allows controlling the behavior of this particular run (e.g., turning tracing on).

    returns

    The evaluated tensors using the structure of fetches. For more details on the return type, please refer to the documentation of the Fetchable type class.

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

    IllegalStateException If this session has already been closed.

  29. def runWithMetadata[F, E, R](feeds: FeedMap = FeedMap.empty, fetches: F = Seq.empty[Output], targets: E = Traversable.empty[Op], options: Option[RunOptions] = None)(implicit executable: Executable[E], fetchable: Aux[F, R]): (R, Option[RunMetadata])

    Permalink

    Runs ops and evaluates tensors in fetches, and returns the values of the evaluated tensors, along with any run metadata that may have been collected.

    Runs ops and evaluates tensors in fetches, and returns the values of the evaluated tensors, along with any run metadata that may have been collected.

    This method runs one "step" of TensorFlow computation, by running the necessary graph fragment to execute every Op and evaluate every Output in fetches, substituting the values in feeds for the corresponding input values.

    When appropriate (e.g., when users turn on tracing in options), the run metadata output of this run will be collected in a RunMetadata protocol buffer and returned by this function.

    feeds

    Optional feed map. This argument can be used to feed values into a TensorFlow session. It is a map from graph nodes to their corresponding Tensor values. More specifically, for all allowed types for this argument, please refer to the documentation of the Feedable type class.

    fetches

    Optional argument specifying which values to fetch from the TensorFlow session. This argument can have various forms and its type defines the return type of this function. Please refer to the documentation of the Fetchable type class for details on the allowed types.

    targets

    Optional argument specifying which ops to execute in the TensorFlow graph, without returning their value. Please refer to the documentation of the Executable type class for details on the allowed types of targets.

    options

    Optional RunOptions protocol buffer that allows controlling the behavior of this particular run (e.g., turning tracing on).

    returns

    A tuple containing two elements:

    • The evaluated tensors using the structure of fetches. For more details on the return type, please refer to the documentation of the Fetchable type class.
    • A RunMetadata protocol buffer option containing the collected run metadata, if any.
    Definition Classes
    Session
    Annotations
    @throws( ... )
    Exceptions thrown

    IllegalStateException If the session has already been closed.

  30. var session: core.client.Session

    Permalink

    Session being wrapped.

    Session being wrapped.

    Attributes
    protected
  31. final def shouldStop: Boolean

    Permalink

    Returns true if this session should not be used anymore.

    Returns true if this session should not be used anymore. This method always return true if the session has been closed already.

  32. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  33. val target: String

    Permalink

    Process to which this session will connect.

    Process to which this session will connect.

    Definition Classes
    Session
  34. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  35. final def wait(): Unit

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

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

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

Inherited from core.client.Session

Inherited from utilities.Closeable

Inherited from AnyRef

Inherited from Any

Ungrouped