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.pad crashes with large paddings #51908

Closed
lugalUrim opened this issue Sep 9, 2021 · 4 comments
Closed

tf.pad crashes with large paddings #51908

lugalUrim opened this issue Sep 9, 2021 · 4 comments
Assignees
Labels
2.6.0 comp:ops OPs related issues stat:awaiting response Status - Awaiting response from author type:bug Bug

Comments

@lugalUrim
Copy link

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
  • 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.6.0
  • Python version: 3.6.8
  • 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.pad crashes when the argument "paddings" has large values.

Describe the expected behavior
Expect an exception to be thrown if the input paddings is unexpected.

Standalone code to reproduce the issue

import tensorflow as tf
input_tensor = tf.random.uniform([1, 32, 32, 3], dtype=tf.float32)
paddings = [[125106557, 1415887920], [747509374, 2136925906], [413308538, 904601717], [1900762018, 831358864]]
res = tf.pad(input_tensor,paddings)

outputs:

2021-09-09 12:46:38.123113: F tensorflow/core/framework/tensor_shape.cc:352] Check failed: 0 <= new_num_elements (0 vs. -1)
Aborted (core dumped)
@sushreebarsa
Copy link
Contributor

@lugalUrim Could you please have a look at the link, and similar issue ,Please let us know if it helps ?Thanks!

@sushreebarsa sushreebarsa added the stat:awaiting response Status - Awaiting response from author label Sep 10, 2021
@lugalUrim
Copy link
Author

Yes, thanks @sushreebarsa for pointing to that. I will close this issue.

@google-ml-butler
Copy link

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

@yongtang
Copy link
Member

In case of check failure, tensorflow should return an error gracefully instead of crash with undefined behaviors. Created a PR #51973 for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.6.0 comp:ops OPs related issues stat:awaiting response Status - Awaiting response from author type:bug Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants