Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support a single Tensor in StagingArea.put() #17863

Merged
merged 2 commits into from
Mar 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions tensorflow/python/ops/data_flow_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,9 @@ def put(self, values, name=None):
its capacity.

Args:
values: Tensor (or a tuple of Tensors) to place into the staging area.
values: A single tensor, a list or tuple of tensors, or a dictionary with
tensor values. The number of elements must match the length of the
list provided to the dtypes argument when creating the StagingArea.
name: A name for the operation (optional).

Returns:
Expand All @@ -1780,11 +1782,12 @@ def put(self, values, name=None):
"""
with ops.name_scope(name, "%s_put" % self._name,
self._scope_vals(values)) as scope:

if not isinstance(values, (list, tuple, dict)):
values = [values]

# Hard-code indices for this staging area
indices = (
list(six.moves.range(len(values)))
if isinstance(values, (list, tuple)) else None)
indices = list(six.moves.range(len(values)))
vals, _ = self._check_put_dtypes(values, indices)

with ops.colocate_with(self._coloc_op):
Expand Down