mirror of
https://github.com/zebrajr/tensorflow.git
synced 2026-01-15 12:15:41 +00:00
Adds eager execution compatibility note in Readers, Queues, and QueueRunner.
Raises a RuntimeError in base classes for QueueBase, ReaderBase, and QueueRunner. PiperOrigin-RevId: 173888425
This commit is contained in:
committed by
TensorFlower Gardener
parent
32ab30cb0a
commit
2e54fd6de7
@@ -123,6 +123,11 @@ class QueueBase(object):
|
||||
@{tf.RandomShuffleQueue} for concrete
|
||||
implementations of this class, and instructions on how to create
|
||||
them.
|
||||
|
||||
@compatibility(eager)
|
||||
Queues are not compatible with eager execution. Instead, please
|
||||
use `tf.data` to get data into your model.
|
||||
@end_compatibility
|
||||
"""
|
||||
|
||||
def __init__(self, dtypes, shapes, names, queue_ref):
|
||||
@@ -146,12 +151,12 @@ class QueueBase(object):
|
||||
|
||||
Raises:
|
||||
ValueError: If one of the arguments is invalid.
|
||||
ValueError: If eager execution is enabled.
|
||||
RuntimeError: If eager execution is enabled.
|
||||
"""
|
||||
if context.in_eager_mode():
|
||||
raise ValueError(
|
||||
"Queues are not supported in TensorFlow with eager execution. "
|
||||
"Instead, use tf.data to get data into your model.")
|
||||
raise RuntimeError(
|
||||
"Queues are not supported when eager execution is enabled. "
|
||||
"Instead, please use tf.data to get data into your model.")
|
||||
self._dtypes = dtypes
|
||||
if shapes is not None:
|
||||
if len(shapes) != len(dtypes):
|
||||
@@ -595,6 +600,11 @@ class RandomShuffleQueue(QueueBase):
|
||||
|
||||
See @{tf.QueueBase} for a description of the methods on
|
||||
this class.
|
||||
|
||||
@compatibility(eager)
|
||||
Queues are not compatible with eager execution. Instead, please
|
||||
use `tf.data` to get data into your model.
|
||||
@end_compatibility
|
||||
"""
|
||||
|
||||
def __init__(self, capacity, min_after_dequeue, dtypes, shapes=None,
|
||||
@@ -668,6 +678,11 @@ class FIFOQueue(QueueBase):
|
||||
|
||||
See @{tf.QueueBase} for a description of the methods on
|
||||
this class.
|
||||
|
||||
@compatibility(eager)
|
||||
Queues are not compatible with eager execution. Instead, please
|
||||
use `tf.data` to get data into your model.
|
||||
@end_compatibility
|
||||
"""
|
||||
|
||||
def __init__(self, capacity, dtypes, shapes=None, names=None,
|
||||
@@ -719,6 +734,11 @@ class PaddingFIFOQueue(QueueBase):
|
||||
|
||||
See @{tf.QueueBase} for a description of the methods on
|
||||
this class.
|
||||
|
||||
@compatibility(eager)
|
||||
Queues are not compatible with eager execution. Instead, please
|
||||
use `tf.data` to get data into your model.
|
||||
@end_compatibility
|
||||
"""
|
||||
|
||||
def __init__(self, capacity, dtypes, shapes, names=None, shared_name=None,
|
||||
@@ -781,6 +801,11 @@ class PriorityQueue(QueueBase):
|
||||
|
||||
See @{tf.QueueBase} for a description of the methods on
|
||||
this class.
|
||||
|
||||
@compatibility(eager)
|
||||
Queues are not compatible with eager execution. Instead, please
|
||||
use `tf.data` to get data into your model.
|
||||
@end_compatibility
|
||||
"""
|
||||
|
||||
def __init__(self, capacity, types, shapes=None, names=None, shared_name=None,
|
||||
|
||||
@@ -70,6 +70,7 @@ from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
from tensorflow.python.eager import context
|
||||
from tensorflow.python.framework import dtypes
|
||||
from tensorflow.python.framework import ops
|
||||
from tensorflow.python.lib.io import python_io
|
||||
@@ -152,6 +153,11 @@ class ReaderBase(object):
|
||||
contains the work units and the Reader dequeues from the queue when
|
||||
it is asked to produce a record (via Read()) but it has finished the
|
||||
last work unit.
|
||||
|
||||
@compatibility(eager)
|
||||
Readers are not compatible with eager execution. Instead, please
|
||||
use `tf.data` to get data into your model.
|
||||
@end_compatibility
|
||||
"""
|
||||
|
||||
def __init__(self, reader_ref, supports_serialize=False):
|
||||
@@ -161,7 +167,15 @@ class ReaderBase(object):
|
||||
reader_ref: The operation that implements the reader.
|
||||
supports_serialize: True if the reader implementation can
|
||||
serialize its state.
|
||||
|
||||
Raises:
|
||||
RuntimeError: If eager execution is enabled.
|
||||
"""
|
||||
if context.in_eager_mode():
|
||||
raise RuntimeError(
|
||||
"Readers are not supported when eager execution is enabled. "
|
||||
"Instead, please use tf.data to get data into your model.")
|
||||
|
||||
self._reader_ref = reader_ref
|
||||
self._supports_serialize = supports_serialize
|
||||
|
||||
@@ -347,6 +361,11 @@ class WholeFileReader(ReaderBase):
|
||||
be a filename (key) and the contents of that file (value).
|
||||
|
||||
See ReaderBase for supported methods.
|
||||
|
||||
@compatibility(eager)
|
||||
Readers are not compatible with eager execution. Instead, please
|
||||
use `tf.data` to get data into your model.
|
||||
@end_compatibility
|
||||
"""
|
||||
|
||||
def __init__(self, name=None):
|
||||
@@ -367,6 +386,11 @@ class TextLineReader(ReaderBase):
|
||||
|
||||
Newlines are stripped from the output.
|
||||
See ReaderBase for supported methods.
|
||||
|
||||
@compatibility(eager)
|
||||
Readers are not compatible with eager execution. Instead, please
|
||||
use `tf.data` to get data into your model.
|
||||
@end_compatibility
|
||||
"""
|
||||
# TODO(josh11b): Support serializing and restoring state.
|
||||
|
||||
@@ -390,6 +414,11 @@ class FixedLengthRecordReader(ReaderBase):
|
||||
"""A Reader that outputs fixed-length records from a file.
|
||||
|
||||
See ReaderBase for supported methods.
|
||||
|
||||
@compatibility(eager)
|
||||
Readers are not compatible with eager execution. Instead, please
|
||||
use `tf.data` to get data into your model.
|
||||
@end_compatibility
|
||||
"""
|
||||
# TODO(josh11b): Support serializing and restoring state.
|
||||
|
||||
@@ -427,6 +456,11 @@ class TFRecordReader(ReaderBase):
|
||||
"""A Reader that outputs the records from a TFRecords file.
|
||||
|
||||
See ReaderBase for supported methods.
|
||||
|
||||
@compatibility(eager)
|
||||
Readers are not compatible with eager execution. Instead, please
|
||||
use `tf.data` to get data into your model.
|
||||
@end_compatibility
|
||||
"""
|
||||
# TODO(josh11b): Support serializing and restoring state.
|
||||
|
||||
@@ -452,6 +486,11 @@ class LMDBReader(ReaderBase):
|
||||
"""A Reader that outputs the records from a LMDB file.
|
||||
|
||||
See ReaderBase for supported methods.
|
||||
|
||||
@compatibility(eager)
|
||||
Readers are not compatible with eager execution. Instead, please
|
||||
use `tf.data` to get data into your model.
|
||||
@end_compatibility
|
||||
"""
|
||||
def __init__(self, name=None, options=None):
|
||||
"""Create a LMDBReader.
|
||||
@@ -474,6 +513,11 @@ class IdentityReader(ReaderBase):
|
||||
work string and output (work, work).
|
||||
|
||||
See ReaderBase for supported methods.
|
||||
|
||||
@compatibility(eager)
|
||||
Readers are not compatible with eager execution. Instead, please
|
||||
use `tf.data` to get data into your model.
|
||||
@end_compatibility
|
||||
"""
|
||||
|
||||
def __init__(self, name=None):
|
||||
|
||||
@@ -44,6 +44,11 @@ class QueueRunner(object):
|
||||
and reporting exceptions, etc.
|
||||
|
||||
The `QueueRunner`, combined with the `Coordinator`, helps handle these issues.
|
||||
|
||||
@compatibility(eager)
|
||||
QueueRunners are not compatible with eager execution. Instead, please
|
||||
use `tf.data` to get data into your model.
|
||||
@end_compatibility
|
||||
"""
|
||||
|
||||
def __init__(self, queue=None, enqueue_ops=None, close_op=None,
|
||||
@@ -80,7 +85,13 @@ class QueueRunner(object):
|
||||
ValueError: If both `queue_runner_def` and `queue` are both specified.
|
||||
ValueError: If `queue` or `enqueue_ops` are not provided when not
|
||||
restoring from `queue_runner_def`.
|
||||
RuntimeError: If eager execution is enabled.
|
||||
"""
|
||||
if context.in_eager_mode():
|
||||
raise RuntimeError(
|
||||
"QueueRunners are not supported when eager execution is enabled. "
|
||||
"Instead, please use tf.data to get data into your model.")
|
||||
|
||||
if queue_runner_def:
|
||||
if queue or enqueue_ops:
|
||||
raise ValueError("queue_runner_def and queue are mutually exclusive.")
|
||||
|
||||
Reference in New Issue
Block a user