You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# From https://www.tensorflow.org/guide/function#using_python_iterators_and_generatorsimporttensorflowastf@tf.functiondefgood_consume_next(iterator):
# This is ok, iterator is a tf.data.Iteratortf.print("Value:", next(iterator))
ds=tf.data.Dataset.from_tensor_slices([1, 2, 3])
iterator=iter(ds)
good_consume_next(iterator)
good_consume_next(iterator)
good_consume_next(iterator)
Above, iterator is over a TF dataset. Calling next() on the iterator moves its cursor over the container. Thus, that would not be considered a Python side-effect, but only because the underlying container is a TF dataset container.
Regression
I believe is a type inferencing problem. The function call to iter() above will return a certain kind of iterator depending on its argument's type:
Consider the following code:
Above,
iterator
is over a TF dataset. Callingnext()
on the iterator moves its cursor over the container. Thus, that would not be considered a Python side-effect, but only because the underlying container is a TF dataset container.Regression
I believe is a type inferencing problem. The function call to
iter()
above will return a certain kind of iterator depending on its argument's type:The text was updated successfully, but these errors were encountered: