LostTech.TensorFlow : API Documentation

Type Iterator

Namespace tensorflow.contrib.eager.python.datasets

Parent IteratorV2

Interfaces IIterator

Public instance methods

object get_next(string name)

Returns a nested structure of tf.Tensors representing the next element.

In graph mode, you should typically call this method *once* and use its result as the input to another computation. A typical loop will then call tf.Session.run on the result of that computation. The loop will terminate when the `Iterator.get_next()` operation raises tf.errors.OutOfRangeError. The following skeleton shows how to use this method when building a training loop: NOTE: It is legitimate to call `Iterator.get_next()` multiple times, e.g. when you are distributing different elements to multiple devices in a single step. However, a common pitfall arises when users call `Iterator.get_next()` in each iteration of their training loop. `Iterator.get_next()` adds ops to the graph, and executing each op allocates resources (including threads); as a consequence, invoking it in every iteration of a training loop causes slowdown and eventual resource exhaustion. To guard against this outcome, we log a warning when the number of uses crosses a fixed threshold of suspiciousness.
Parameters
string name
(Optional.) A name for the created operation.
Returns
object
A nested structure of tf.Tensor objects.
Show Example
dataset =...  # A tf.data.Dataset object.
            iterator = dataset.make_initializable_iterator()
            next_element = iterator.get_next() 

# Build a TensorFlow graph that does something with each element. loss = model_function(next_element) optimizer =... # A `tf.compat.v1.train.Optimizer` object. train_op = optimizer.minimize(loss)

with tf.compat.v1.Session() as sess: try: while True: sess.run(train_op) except tf.errors.OutOfRangeError: pass

object get_next_dyn(object name)

Returns a nested structure of tf.Tensors representing the next element.

In graph mode, you should typically call this method *once* and use its result as the input to another computation. A typical loop will then call tf.Session.run on the result of that computation. The loop will terminate when the `Iterator.get_next()` operation raises tf.errors.OutOfRangeError. The following skeleton shows how to use this method when building a training loop: NOTE: It is legitimate to call `Iterator.get_next()` multiple times, e.g. when you are distributing different elements to multiple devices in a single step. However, a common pitfall arises when users call `Iterator.get_next()` in each iteration of their training loop. `Iterator.get_next()` adds ops to the graph, and executing each op allocates resources (including threads); as a consequence, invoking it in every iteration of a training loop causes slowdown and eventual resource exhaustion. To guard against this outcome, we log a warning when the number of uses crosses a fixed threshold of suspiciousness.
Parameters
object name
(Optional.) A name for the created operation.
Returns
object
A nested structure of tf.Tensor objects.
Show Example
dataset =...  # A tf.data.Dataset object.
            iterator = dataset.make_initializable_iterator()
            next_element = iterator.get_next() 

# Build a TensorFlow graph that does something with each element. loss = model_function(next_element) optimizer =... # A `tf.compat.v1.train.Optimizer` object. train_op = optimizer.minimize(loss)

with tf.compat.v1.Session() as sess: try: while True: sess.run(train_op) except tf.errors.OutOfRangeError: pass

Public properties

object element_spec get;

object element_spec_dyn get;

object output_classes get;

object output_classes_dyn get;

object output_shapes get;

object output_shapes_dyn get;

object output_types get;

object output_types_dyn get;

object PythonObject get;