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

fix character access in autograph #21580

Merged
merged 7 commits into from
Sep 8, 2018
Merged

fix character access in autograph #21580

merged 7 commits into from
Sep 8, 2018

Conversation

ariwaranosai
Copy link
Contributor

fix #20703 by extending the tensor index operator.

@caisq caisq requested a review from mdanatg August 13, 2018 17:48
@caisq caisq added the awaiting review Pull request awaiting review label Aug 13, 2018
@ariwaranosai
Copy link
Contributor Author

@mdanatg could you take a look?

@tensorflowbutler
Copy link
Member

Nagging Reviewer @mdanatg: You have been added as a reviewer to this pull request. Please add your review or reassign. It has been 16 days with no activity and the awaiting review label has been applied.

@mdanatg
Copy link

mdanatg commented Aug 31, 2018

This is great! Sorry for the delay, I just got back from vacation.

mdanatg
mdanatg previously approved these changes Aug 31, 2018
@@ -46,6 +46,19 @@ def test_get_item_tensor_list(self):
with self.test_session() as sess:
self.assertAllEqual(sess.run(t), [3, 4])

def test_get_item_tensor_string(self):
initial_str = constant_op.constant("abcd")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, please use single quotation marks for single-line strings.

@tensorflowbutler tensorflowbutler removed the awaiting review Pull request awaiting review label Sep 1, 2018
@ariwaranosai
Copy link
Contributor Author

@mdanatg you are right, fixed.

mdanatg
mdanatg previously approved these changes Sep 4, 2018
@ariwaranosai
Copy link
Contributor Author

I just realized this will raise error for tensor of string. This should only apply for string with rank 0.
@mdanatg

@@ -58,7 +58,7 @@ def get_item(target, i, opts):
elif tensor_util.is_tensor(target):
if target.dtype == dtypes.variant:
return _tf_tensor_list_get_item(target, i, opts)
if target.dtype == dtypes.string:
elif target.dtype == dtypes.string and target.get_shape() == (): # target is string with rank 0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More idiomatic: target.shape.ndims == 0

https://www.tensorflow.org/api_docs/python/tf/TensorShape#ndims

@caisq caisq added the ready to pull PR ready for merge process label Sep 6, 2018
@tensorflow-copybara tensorflow-copybara merged commit 9c7ca4c into tensorflow:master Sep 8, 2018
tensorflow-copybara pushed a commit that referenced this pull request Sep 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes ready to pull PR ready for merge process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Character access is not supported in tf.contrib.autograph
7 participants