mirror of
https://github.com/zebrajr/tensorflow.git
synced 2025-12-07 00:20:20 +01:00
Dataset: Adds eager warnings to make_initializable_iterator and make_one_shot_iterator.
PiperOrigin-RevId: 173949737
This commit is contained in:
parent
1d6dae88ef
commit
25620825bc
|
|
@ -25,6 +25,7 @@ import numpy as np
|
|||
|
||||
from tensorflow.python.data.ops import iterator_ops
|
||||
from tensorflow.python.data.util import nest
|
||||
from tensorflow.python.eager import context
|
||||
from tensorflow.python.framework import constant_op
|
||||
from tensorflow.python.framework import dtypes
|
||||
from tensorflow.python.framework import function
|
||||
|
|
@ -80,7 +81,14 @@ class Dataset(object):
|
|||
|
||||
Returns:
|
||||
An `Iterator` over the elements of this dataset.
|
||||
|
||||
Raises:
|
||||
RuntimeError: If eager execution is enabled.
|
||||
"""
|
||||
if context.in_eager_mode():
|
||||
raise RuntimeError(
|
||||
"dataset.make_initializable_iterator is not supported when eager "
|
||||
"execution is enabled.")
|
||||
if shared_name is None:
|
||||
shared_name = ""
|
||||
iterator_resource = gen_dataset_ops.iterator(
|
||||
|
|
@ -102,7 +110,14 @@ class Dataset(object):
|
|||
|
||||
Returns:
|
||||
An `Iterator` over the elements of this dataset.
|
||||
|
||||
Raises:
|
||||
RuntimeError: If eager execution is enabled.
|
||||
"""
|
||||
if context.in_eager_mode():
|
||||
raise RuntimeError(
|
||||
"dataset.make_one_shot_iterator is not supported when eager "
|
||||
"execution is enabled.")
|
||||
# NOTE(mrry): We capture by value here to ensure that `_make_dataset()` is
|
||||
# a 0-argument function.
|
||||
@function.Defun(capture_by_value=True)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user