Class/Object

org.platanios.tensorflow.api.learn.hooks

TensorLogger

Related Docs: object TensorLogger | package hooks

Permalink

class TensorLogger extends TriggeredHook

Logs the values of the provided tensors based on a HookTrigger, or at the end of a run (i.e., end of a Session's usage. The tensors will be printed using INFO logging level/severity. If you are not seeing the logs, you might want to changing the logging level in your logging configuration file.

Note that if logAtEnd is true, tensors should not include any tensor whose evaluation produces a side effect, such as consuming additional inputs.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TensorLogger
  2. TriggeredHook
  3. Hook
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TensorLogger(tensors: Map[String, String], trigger: HookTrigger = StepHookTrigger(1), triggerAtEnd: Boolean = true, formatter: (Map[String, tensors.Tensor[types.DataType]]) ⇒ String = null)

    Permalink

    tensors

    Map from tags to tensor names. The tags are used to identify the tensors in the log.

    trigger

    Hook trigger specifying when this hook is triggered (i.e., when it executes). If you only want to log the tensor values at the end of a run and not during, then you should set trigger to NoHookTrigger and logAtEnd to true.

    triggerAtEnd

    If true, this hook will be triggered at the end of the run. Note that if this flag is set to true, then tensors must be computable without using a feed map for the Session.run() call.

    formatter

    Function used to format the strings being logged that takes a Map[String, Tensor] as input, with the keys corresponding to tags, and returns a string to log. Defaults to a simple summary of all the tensors in the map.

    Attributes
    protected

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 afterSessionCreation(session: core.client.Session): Unit

    Permalink

    Called after a new session is created.

    Called after a new session is created. This is called to signal the hooks that a new session has been created. This callback has two essential differences with the situation in which begin() is called:

    • When this is called, the graph is finalized and ops can no longer be added to it.
    • This method will also be called as a result of recovering a wrapped session (i.e., not only at the beginning of the overall session).
    session

    The session that has been created.

    Attributes
    protected
    Definition Classes
    Hook
  5. final def afterSessionRun[F, E, R](runContext: SessionRunContext[F, E, R], runResult: SessionRunResult[Seq[ops.Output], Seq[tensors.Tensor[types.DataType]]])(implicit executableEv: Executable[E], fetchableEv: Aux[F, R]): Unit

    Permalink

    Called after each call to Session.run().

    Called after each call to Session.run().

    The runContext argument is the same one passed to beforeSessionRun(). runContext.requestStop() can be called to stop the iteration.

    The runResult argument contains fetched values for the tensors requested by beforeSessionRun().

    If Session.run() throws any exception, then afterSessionRun() will not be called. Note the difference between the end() and the afterSessionRun() behavior when Session.run() throws an OutOfRangeException. In that case, end() is called but afterSessionRun() is not called.

    runContext

    Provides information about the run call (i.e., the originally requested ops/tensors, the session, etc.). Same value as that passed to beforeSessionRun.

    runResult

    Result of the Session.run() call that includes the fetched values for the tensors requested by beforeSessionRun().

    Attributes
    protected
    Definition Classes
    TriggeredHookHook
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. final def beforeSessionRun[F, E, R](runContext: SessionRunContext[F, E, R])(implicit executableEv: Executable[E], fetchableEv: Aux[F, R]): Option[SessionRunArgs[Seq[ops.Output], Traversable[ops.Op], Seq[tensors.Tensor[types.DataType]]]]

    Permalink

    Called before each call to Session.run().

    Called before each call to Session.run(). You can return from this call a Hook.SessionRunArgs object indicating ops or tensors to add to the upcoming run call. These ops/tensors will be run together with the ops/tensors originally passed to the original run call. The run arguments you return can also contain feeds to be added to the run call.

    The runContext argument is a Hook.SessionRunContext that provides information about the upcoming run call (i.e., the originally requested ops/tensors, the session, etc.).

    At this point the graph is finalized and you should not add any new ops.

    runContext

    Provides information about the upcoming run call (i.e., the originally requested ops/tensors, the session, etc.).

    Attributes
    protected
    Definition Classes
    TriggeredHookHook
  8. def begin(): Unit

    Permalink

    Called once before creating the session.

    Called once before creating the session. When called, the default graph is the one that will be launched in the session. The hook can modify the graph by adding new operations to it. After the begin call the graph will be finalized and the other callbacks will not be able to modify the graph anymore. A second begin call on the same graph, should not change that graph.

    Attributes
    protected
    Definition Classes
    TensorLoggerHook
  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def end(session: core.client.Session): Unit

    Permalink

    Called at the end of the session usage (i.e., Session.run() will not be invoked again after this call).

    Called at the end of the session usage (i.e., Session.run() will not be invoked again after this call).

    The session argument can be used in case the hook wants to execute any final ops, such as saving a last checkpoint.

    If Session.run() throws any exception other than OutOfRangeException then end() will not be called. Note the difference between the end() and the afterSessionRun() behavior when Session.run() throws an OutOfRangeException. In that case, end() is called but afterSessionRun() is not called.

    session

    Session that will not be used again after this call.

    Attributes
    protected
    Definition Classes
    Hook
  11. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  13. def fetches: Seq[ops.Output]

    Permalink
    Attributes
    protected
    Definition Classes
    TensorLoggerTriggeredHook
  14. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. val formatter: (Map[String, tensors.Tensor[types.DataType]]) ⇒ String

    Permalink

    Function used to format the strings being logged that takes a Map[String, Tensor] as input, with the keys corresponding to tags, and returns a string to log.

    Function used to format the strings being logged that takes a Map[String, Tensor] as input, with the keys corresponding to tags, and returns a string to log. Defaults to a simple summary of all the tensors in the map.

  16. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  17. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  18. val internalTrigger: HookTrigger

    Permalink
    Attributes
    protected
    Definition Classes
    TriggeredHook
  19. final def isInstanceOf[T0]: Boolean

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

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

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

    Permalink
    Definition Classes
    AnyRef
  23. def onFirstTrigger[F, E, R](runContext: SessionRunContext[F, E, R])(implicit executableEv: Executable[E], fetchableEv: Aux[F, R]): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    TriggeredHook
  24. def onTrigger(step: Long, elapsed: Option[(Double, Int)], runResult: SessionRunResult[Seq[ops.Output], Seq[tensors.Tensor[types.DataType]]], session: core.client.Session): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    TensorLoggerTriggeredHook
  25. def runOptions: Option[RunOptions]

    Permalink
    Attributes
    protected
    Definition Classes
    TriggeredHook
  26. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  27. val tensors: Map[String, String]

    Permalink

    Map from tags to tensor names.

    Map from tags to tensor names. The tags are used to identify the tensors in the log.

  28. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  29. val trigger: HookTrigger

    Permalink

    Hook trigger specifying when this hook is triggered (i.e., when it executes).

    Hook trigger specifying when this hook is triggered (i.e., when it executes). If you only want to log the tensor values at the end of a run and not during, then you should set trigger to NoHookTrigger and logAtEnd to true.

  30. val triggerAtEnd: Boolean

    Permalink

    If true, this hook will be triggered at the end of the run.

    If true, this hook will be triggered at the end of the run. Note that if this flag is set to true, then tensors must be computable without using a feed map for the Session.run() call.

  31. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. def wantMetadata: Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    TriggeredHook

Inherited from TriggeredHook

Inherited from Hook

Inherited from AnyRef

Inherited from Any

Ungrouped