LostTech.TensorFlow : API Documentation

Type LooperThread

Namespace tensorflow.train

Parent PythonObjectContainer

Interfaces ILooperThread

A thread that runs code repeatedly, optionally on a timer.

This thread class is intended to be used with a `Coordinator`. It repeatedly runs code specified either as `target` and `args` or by the `run_loop()` method.

Before each run the thread checks if the coordinator has requested stop. In that case the looper thread terminates immediately.

If the code being run raises an exception, that exception is reported to the coordinator and the thread terminates. The coordinator will then request all the other threads it coordinates to stop.

You typically pass looper threads to the supervisor `Join()` method.

Methods

Properties

Public instance methods

object run_loop_dyn()

Called at 'timer_interval_secs' boundaries.

object start_loop_dyn()

Called when the thread starts.

object stop_loop_dyn()

Called when the thread stops.

Public static methods

LooperThread loop(Coordinator coord, int timer_interval_secs, object target, Nullable<ValueTuple<Coordinator, IEnumerable<int>>> args, IDictionary<string, IEnumerable<int>> kwargs)

Start a LooperThread that calls a function periodically.

If `timer_interval_secs` is None the thread calls `target(args)` repeatedly. Otherwise `target(args)` is called every `timer_interval_secs` seconds. The thread terminates when a stop of the coordinator is requested.
Parameters
Coordinator coord
A Coordinator.
int timer_interval_secs
Number. Time boundaries at which to call `target`.
object target
A callable object.
Nullable<ValueTuple<Coordinator, IEnumerable<int>>> args
Optional arguments to pass to `target` when calling it.
IDictionary<string, IEnumerable<int>> kwargs
Optional keyword arguments to pass to `target` when calling it.
Returns
LooperThread
The started thread.

object loop_dyn(object coord, object timer_interval_secs, object target, object args, object kwargs)

Start a LooperThread that calls a function periodically.

If `timer_interval_secs` is None the thread calls `target(args)` repeatedly. Otherwise `target(args)` is called every `timer_interval_secs` seconds. The thread terminates when a stop of the coordinator is requested.
Parameters
object coord
A Coordinator.
object timer_interval_secs
Number. Time boundaries at which to call `target`.
object target
A callable object.
object args
Optional arguments to pass to `target` when calling it.
object kwargs
Optional keyword arguments to pass to `target` when calling it.
Returns
object
The started thread.

Public properties

bool daemon get; set;

A boolean value indicating whether this thread is a daemon thread.

This must be set before start() is called, otherwise RuntimeError is raised. Its initial value is inherited from the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to daemon = False.

The entire Python program exits when only daemon threads are left.

object PythonObject get;