LostTech.TensorFlow : API Documentation

Type ReaderBase

Namespace tensorflow

Parent PythonObjectContainer

Interfaces IReaderBase

Base class for different Reader types, that produce a record every step.

Conceptually, Readers convert string 'work units' into records (key, value pairs). Typically the 'work units' are filenames and the records are extracted from the contents of those files. We want a single record produced per step, but a work unit can correspond to many records.

Therefore we introduce some decoupling using a queue. The queue contains the work units and the Reader dequeues from the queue when it is asked to produce a record (via Read()) but it has finished the last work unit.

Methods

Properties

Public instance methods

Tensor num_records_produced(string name)

Returns the number of records this reader has produced.

This is the same as the number of Read executions that have succeeded.
Parameters
string name
A name for the operation (optional).
Returns
Tensor
An int64 Tensor.

object num_records_produced_dyn(object name)

Returns the number of records this reader has produced.

This is the same as the number of Read executions that have succeeded.
Parameters
object name
A name for the operation (optional).
Returns
object
An int64 Tensor.

Tensor num_work_units_completed(string name)

Returns the number of work units this reader has finished processing.
Parameters
string name
A name for the operation (optional).
Returns
Tensor
An int64 Tensor.

object num_work_units_completed_dyn(object name)

Returns the number of work units this reader has finished processing.
Parameters
object name
A name for the operation (optional).
Returns
object
An int64 Tensor.

IDictionary<object, object> read(FIFOQueue queue, string name)

Returns the next record (key, value) pair produced by a reader.

Will dequeue a work unit from queue if necessary (e.g. when the Reader needs to start reading from a new file since it has finished with the previous file).
Parameters
FIFOQueue queue
A Queue or a mutable string Tensor representing a handle to a Queue, with string work items.
string name
A name for the operation (optional).
Returns
IDictionary<object, object>
A tuple of Tensors (key, value).

IDictionary<object, object> read(IGraphNodeBase queue, string name)

Read the value at location `index` in the TensorArray.
Parameters
IGraphNodeBase queue
string name
A name for the operation (optional).
Returns
IDictionary<object, object>
The tensor at index `index`.

object read_dyn(object queue, object name)

Read the value at location `index` in the TensorArray.
Parameters
object queue
object name
A name for the operation (optional).
Returns
object
The tensor at index `index`.

IDictionary<object, object> read_up_to(FIFOQueue queue, Nullable<int> num_records, string name)

Returns up to num_records (key, value) pairs produced by a reader.

Will dequeue a work unit from queue if necessary (e.g., when the Reader needs to start reading from a new file since it has finished with the previous file). It may return less than num_records even before the last batch.
Parameters
FIFOQueue queue
A Queue or a mutable string Tensor representing a handle to a Queue, with string work items.
Nullable<int> num_records
Number of records to read.
string name
A name for the operation (optional).
Returns
IDictionary<object, object>
A tuple of Tensors (keys, values).

IDictionary<object, object> read_up_to(IGraphNodeBase queue, Nullable<int> num_records, string name)

Returns up to num_records (key, value) pairs produced by a reader.

Will dequeue a work unit from queue if necessary (e.g., when the Reader needs to start reading from a new file since it has finished with the previous file). It may return less than num_records even before the last batch.
Parameters
IGraphNodeBase queue
A Queue or a mutable string Tensor representing a handle to a Queue, with string work items.
Nullable<int> num_records
Number of records to read.
string name
A name for the operation (optional).
Returns
IDictionary<object, object>
A tuple of Tensors (keys, values).

object read_up_to_dyn(object queue, object num_records, object name)

Returns up to num_records (key, value) pairs produced by a reader.

Will dequeue a work unit from queue if necessary (e.g., when the Reader needs to start reading from a new file since it has finished with the previous file). It may return less than num_records even before the last batch.
Parameters
object queue
A Queue or a mutable string Tensor representing a handle to a Queue, with string work items.
object num_records
Number of records to read.
object name
A name for the operation (optional).
Returns
object
A tuple of Tensors (keys, values).

object reset(string name)

Restore a reader to its initial clean state.
Parameters
string name
A name for the operation (optional).
Returns
object
The created Operation.

object reset_dyn(object name)

Resets the generator by a new state.

See `__init__` for the meaning of "state".

object restore_state(IEnumerable<object> state, string name)

Restore a reader to a previously saved state.

Not all Readers support being restored, so this can produce an Unimplemented error.
Parameters
IEnumerable<object> state
A string Tensor. Result of a SerializeState of a Reader with matching type.
string name
A name for the operation (optional).
Returns
object
The created Operation.

object restore_state_dyn(object state, object name)

Restore a reader to a previously saved state.

Not all Readers support being restored, so this can produce an Unimplemented error.
Parameters
object state
A string Tensor. Result of a SerializeState of a Reader with matching type.
object name
A name for the operation (optional).
Returns
object
The created Operation.

Tensor serialize_state(string name)

Produce a string tensor that encodes the state of a reader.

Not all Readers support being serialized, so this can produce an Unimplemented error.
Parameters
string name
A name for the operation (optional).
Returns
Tensor
A string Tensor.

object serialize_state_dyn(object name)

Produce a string tensor that encodes the state of a reader.

Not all Readers support being serialized, so this can produce an Unimplemented error.
Parameters
object name
A name for the operation (optional).
Returns
object
A string Tensor.

Public properties

object PythonObject get;

object reader_ref get;

Op that implements the reader.

object reader_ref_dyn get;

Op that implements the reader.

bool supports_serialize get;

Whether the Reader implementation can serialize its state.

object supports_serialize_dyn get;

Whether the Reader implementation can serialize its state.