aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/training
diff options
context:
space:
mode:
authorGravatar Derek Murray <mrry@google.com>2018-09-05 17:25:13 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-05 17:31:57 -0700
commit680e1754b49362858cda8fd6cea52e1cc4c41e6b (patch)
treee18e9f93887620fe1097ec24aef29f059ac5fcc3 /tensorflow/python/training
parent857b55492b311cf4161e8528f7e7e9227fc912af (diff)
Deprecate `tf.train.input_producer()` and related APIs.
These APIs are based on queue runners, which have been deprecated and will be removed in TensorFlow 2.0. They have been replaced with `tf.data.Dataset`, which provides a more efficient version of the same functionality. PiperOrigin-RevId: 211727844
Diffstat (limited to 'tensorflow/python/training')
-rw-r--r--tensorflow/python/training/input.py32
1 files changed, 27 insertions, 5 deletions
diff --git a/tensorflow/python/training/input.py b/tensorflow/python/training/input.py
index 94c6b47027..9d9db70890 100644
--- a/tensorflow/python/training/input.py
+++ b/tensorflow/python/training/input.py
@@ -76,7 +76,10 @@ def match_filenames_once(pattern, name=None):
collections=[ops.GraphKeys.LOCAL_VARIABLES])
-@tf_export("train.limit_epochs")
+@tf_export(v1=["train.limit_epochs"])
+@deprecation.deprecated(
+ None, "Queue-based input pipelines have been replaced by `tf.data`. Use "
+ "`tf.data.Dataset.from_tensors(tensor).repeat(num_epochs)`.")
def limit_epochs(tensor, num_epochs=None, name=None):
"""Returns tensor `num_epochs` times and then raises an `OutOfRange` error.
@@ -109,7 +112,12 @@ def limit_epochs(tensor, num_epochs=None, name=None):
return array_ops.identity(tensor, name=name)
-@tf_export("train.input_producer")
+@tf_export(v1=["train.input_producer"])
+@deprecation.deprecated(
+ None, "Queue-based input pipelines have been replaced by `tf.data`. Use "
+ "`tf.data.Dataset.from_tensor_slices(input_tensor).shuffle"
+ "(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs)`. If "
+ "`shuffle=False`, omit the `.shuffle(...)`.")
def input_producer(input_tensor,
element_shape=None,
num_epochs=None,
@@ -192,7 +200,12 @@ def input_producer(input_tensor,
return q
-@tf_export("train.string_input_producer")
+@tf_export(v1=["train.string_input_producer"])
+@deprecation.deprecated(
+ None, "Queue-based input pipelines have been replaced by `tf.data`. Use "
+ "`tf.data.Dataset.from_tensor_slices(string_tensor).shuffle"
+ "(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs)`. If "
+ "`shuffle=False`, omit the `.shuffle(...)`.")
def string_input_producer(string_tensor,
num_epochs=None,
shuffle=True,
@@ -262,7 +275,11 @@ def string_input_producer(string_tensor,
cancel_op=cancel_op)
-@tf_export("train.range_input_producer")
+@tf_export(v1=["train.range_input_producer"])
+@deprecation.deprecated(
+ None, "Queue-based input pipelines have been replaced by `tf.data`. Use "
+ "`tf.data.Dataset.range(limit).shuffle(limit).repeat(num_epochs)`. If "
+ "`shuffle=False`, omit the `.shuffle(...)`.")
def range_input_producer(limit, num_epochs=None, shuffle=True, seed=None,
capacity=32, shared_name=None, name=None):
"""Produces the integers from 0 to limit-1 in a queue.
@@ -300,7 +317,12 @@ def range_input_producer(limit, num_epochs=None, shuffle=True, seed=None,
shared_name, "fraction_of_%d_full" % capacity, name)
-@tf_export("train.slice_input_producer")
+@tf_export(v1=["train.slice_input_producer"])
+@deprecation.deprecated(
+ None, "Queue-based input pipelines have been replaced by `tf.data`. Use "
+ "`tf.data.Dataset.from_tensor_slices(tuple(tensor_list)).shuffle"
+ "(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs)`. If "
+ "`shuffle=False`, omit the `.shuffle(...)`.")
def slice_input_producer(tensor_list, num_epochs=None, shuffle=True, seed=None,
capacity=32, shared_name=None, name=None):
"""Produces a slice of each `Tensor` in `tensor_list`.