tf.raw_ops.OneShotIterator
Stay organized with collections
Save and categorize content based on your preferences.
Makes a "one-shot" iterator that can be iterated only once.
tf.raw_ops.OneShotIterator(
dataset_factory,
output_types,
output_shapes,
container='',
shared_name='',
name=None
)
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 .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tf.raw_ops.OneShotIterator\n\n\u003cbr /\u003e\n\nMakes a \"one-shot\" iterator that can be iterated only once.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.raw_ops.OneShotIterator`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/OneShotIterator)\n\n\u003cbr /\u003e\n\n tf.raw_ops.OneShotIterator(\n dataset_factory,\n output_types,\n output_shapes,\n container='',\n shared_name='',\n name=None\n )\n\nA one-shot iterator bundles the logic for defining the dataset and\nthe state of the iterator in a single op, which allows simple input\npipelines to be defined without an additional initialization\n(\"MakeIterator\") step.\n\nOne-shot iterators have the following limitations:\n\n- They do not support parameterization: all logic for creating the underlying dataset must be bundled in the `dataset_factory` function.\n- 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.\n\nFor greater flexibility, use \"Iterator\" and \"MakeIterator\" to define\nan iterator using an arbitrary subgraph, which may capture tensors\n(including fed values) as parameters, and which may be reset multiple\ntimes by rerunning \"MakeIterator\".\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------------|----------------------------------------------------------------------------------------------------------------------|\n| `dataset_factory` | A function decorated with @Defun. A function of type `() -\u003e DT_VARIANT`, where the returned DT_VARIANT is a dataset. |\n| `output_types` | A list of `tf.DTypes` that has length `\u003e= 1`. |\n| `output_shapes` | A list of shapes (each a [`tf.TensorShape`](../../tf/TensorShape) or list of `ints`) that has length `\u003e= 1`. |\n| `container` | An optional `string`. Defaults to `\"\"`. |\n| `shared_name` | An optional `string`. Defaults to `\"\"`. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor` of type `resource`. ||\n\n\u003cbr /\u003e"]]