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

tf.strings.substr crashes(aborts) #46900

Closed
DNXie opened this issue Feb 3, 2021 · 3 comments · Fixed by #46974
Closed

tf.strings.substr crashes(aborts) #46900

DNXie opened this issue Feb 3, 2021 · 3 comments · Fixed by #46974
Assignees
Labels
comp:ops OPs related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 2.1 for tracking issues in 2.1 release TF 2.4 for issues related to TF 2.4 type:bug Bug

Comments

@DNXie
Copy link

DNXie commented Feb 3, 2021

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 18.04
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: N/A
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below):2.1.0
  • Python version:3.7.6
  • Bazel version (if compiling from source):N/A
  • GCC/Compiler version (if compiling from source):N/A
  • CUDA/cuDNN version:N/A
  • GPU model and memory:N/A

Describe the current behavior
tf.strings.substr crashes(aborts) when len(pos) > len(input)

Describe the expected behavior
expect an exception message if the input unexpected instead of crash.

Standalone code to reproduce the issue

import tensorflow as tf
tf.strings.substr(input='abc', len=1, pos=[1,-1])
import tensorflow as tf
tf.strings.substr(input='abc', len=1, pos=[1,2])

Output:

2021-02-03 22:46:41.234297: F ./tensorflow/core/framework/tensor.h:806] Check failed: new_num_elements == NumElements() (2 vs. 1)
Aborted (core dumped)
@DNXie DNXie added the type:bug Bug label Feb 3, 2021
@DNXie DNXie changed the title tf.strings.substr crashes(aborts) when pos contains negative number tf.strings.substr crashes(aborts) Feb 3, 2021
@Saduf2019 Saduf2019 added TF 2.1 for tracking issues in 2.1 release comp:ops OPs related issues labels Feb 4, 2021
@Saduf2019
Copy link
Contributor

@rmothukuru
I ran the code shared on tf 2.4 and nightly, colab crashes, please find the gist here.

@Saduf2019 Saduf2019 assigned rmothukuru and unassigned Saduf2019 Feb 4, 2021
@rmothukuru rmothukuru added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Feb 5, 2021
@Saduf2019 Saduf2019 added the TF 2.4 for issues related to TF 2.4 label Feb 5, 2021
@yongtang
Copy link
Member

yongtang commented Feb 6, 2021

According to documentation https://www.tensorflow.org/api_docs/python/tf/strings/substr an error should be thrown out gracefully (instead of a crash). Added a PR #46974 for the fix.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@geetachavan1 geetachavan1 added this to Done in TensorFlow 2.5 Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:ops OPs related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 2.1 for tracking issues in 2.1 release TF 2.4 for issues related to TF 2.4 type:bug Bug
Projects
Development

Successfully merging a pull request may close this issue.

4 participants