View source on GitHub |
Creates an iterator for elements of dataset
.
tf.compat.v1.data.make_initializable_iterator(
dataset, shared_name=None
)
Migrate to TF2
This is a legacy API for consuming dataset elements and should only be used during transition from TF 1 to TF 2. Note that using this API should be a transient state of your code base as there are in general no guarantees about the interoperability of TF 1 and TF 2 code.
In TF 2 datasets are Python iterables which means you can consume their
elements using for elem in dataset: ...
or by explicitly creating iterator
via iterator = iter(dataset)
and fetching its elements via
values = next(iterator)
.
Description
dataset = ...
iterator = tf.compat.v1.data.make_initializable_iterator(dataset)
# ...
sess.run(iterator.initializer)
Args | |
---|---|
dataset
|
A tf.data.Dataset .
|
shared_name
|
(Optional.) If non-empty, the returned iterator will be shared under the given name across multiple sessions that share the same devices (e.g. when using a remote server). |
Returns | |
---|---|
A tf.data.Iterator for elements of dataset .
|
Raises | |
---|---|
RuntimeError
|
If eager execution is enabled. |