W3cubDocs

/TensorFlow 2.4

tf.raw_ops.OneShotIterator

Makes a "one-shot" iterator that can be iterated only once.

A one-shot iterator bundles the logic for defining the dataset and the state of the iterator in a single op, which allows simple input pipelines to be defined without an additional initialization ("MakeIterator") step.

One-shot iterators have the following limitations:

  • They do not support parameterization: all logic for creating the underlying dataset must be bundled in the dataset_factory function.
  • They are not resettable. Once a one-shot iterator reaches the end of its underlying dataset, subsequent "IteratorGetNext" operations on that iterator will always produce an OutOfRange error.

For greater flexibility, use "Iterator" and "MakeIterator" to define an iterator using an arbitrary subgraph, which may capture tensors (including fed values) as parameters, and which may be reset multiple times by rerunning "MakeIterator".

Args
dataset_factory A function decorated with @Defun. A function of type () -> DT_VARIANT, where the returned DT_VARIANT is a dataset.
output_types A list of tf.DTypes that has length >= 1.
output_shapes A list of shapes (each a tf.TensorShape or list of ints) that has length >= 1.
container An optional string. Defaults to "".
shared_name An optional string. Defaults to "".
name A name for the operation (optional).
Returns
A Tensor of type resource.

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/raw_ops/OneShotIterator