[go: nahoru, domu]

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.raw_ops.UnicodeEncode: Segmentation fault (core dumped) #63379

Closed
vraebfdsb opened this issue Mar 10, 2024 · 5 comments
Closed

tf.raw_ops.UnicodeEncode: Segmentation fault (core dumped) #63379

vraebfdsb opened this issue Mar 10, 2024 · 5 comments
Assignees
Labels
comp:ops OPs related issues stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author TF 2.15 For issues related to 2.15.x type:bug Bug

Comments

@vraebfdsb
Copy link

Issue type

Bug

Have you reproduced the bug with TensorFlow Nightly?

Yes

Source

binary

TensorFlow version

tf 2.15

Custom code

Yes

OS platform and distribution

Ubuntu 20.04

Mobile device

No response

Python version

3.9

Bazel version

No response

GCC/compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

Under specific input, tf.raw_ops.UnicodeEncode encounters "Segmentation fault (core dumped)".

Standalone code to reproduce the issue

import tensorflow as tf

# Generate input data
input_values = tf.constant([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100])  # Unicode codepoints for "Hello World"
input_splits = tf.constant([[0, 5, 11]])  # Split indices for the input_values with two dimensions
output_encoding = "UTF-8"

# Invoke tf.raw_ops.unicode_encode
output = tf.raw_ops.UnicodeEncode(input_values=input_values, input_splits=input_splits, output_encoding=output_encoding)

# Print the output
print(output)

Relevant log output

Segmentation fault (core dumped)
@google-ml-butler google-ml-butler bot added the type:bug Bug label Mar 10, 2024
@SuryanarayanaY SuryanarayanaY added TF 2.15 For issues related to 2.15.x comp:ops OPs related issues labels Mar 11, 2024
@SuryanarayanaY
Copy link
Collaborator

Hi @nonenone12135 ,

Thanks for reporting. Replicated the reported issue. I am unsure why this check below is not worked.

TF_RETURN_IF_ERROR(c->WithRank(splits_shape, 1, &unused));

Will check and come back. Thanks!

@SuryanarayanaY SuryanarayanaY added the awaiting review Pull request awaiting review label Mar 15, 2024
copybara-service bot pushed a commit that referenced this issue Apr 2, 2024
Imported from GitHub PR #63398

The Op UnicodeEncode segfaults when passed 2D tensor to `input_splits`.

It has the below check in `SetShapeFn` which supposed to raise exception if `rank !=1` AFAIk. This seems not working for reason unknown to me.

https://github.com/tensorflow/tensorflow/blob/6f64ad5d767a034df45a5eaab8b36fd688cd1217/tensorflow/core/ops/string_ops.cc#L316-L317

Same with `input_values` argument also.

Added an explicit check in Op.

Ref issue #63379
Copybara import of the project:

--
176048a by Surya <116063290+SuryanarayanaY@users.noreply.github.com>:

Fix checkfail in UnicodeEncode Op

The Op UnicodeEncode segfaults when passed 2D tensor to `input_splits`.

It has the below check in SetShapeFn which supposed to raise exception if rank !=1 AFAIk. This seems not working for reason unknown to me.

https://github.com/tensorflow/tensorflow/blob/6f64ad5d767a034df45a5eaab8b36fd688cd1217/tensorflow/core/ops/string_ops.cc#L316-L317

Same with input_values argument also.

Added an explicit check in Op.

Merging this change closes #63398

FUTURE_COPYBARA_INTEGRATE_REVIEW=#63398 from tensorflow:Surya_UnicodeEncode 176048a
PiperOrigin-RevId: 620612470
@tilakrayal
Copy link
Contributor

@vraebfdsb,
I tried to execute the mentioned code on tf-nightly and observed that the UnicodeEncode is executed without the Segmentation fault and the output error is as expected. Also the PR raised for the same has been merged. Kindly find the gist of it here.

#63398
Note: With tensorflow 2.15 and 2.16, the same Ops was failing with the Segmentation fault.
Thank you!

@tilakrayal tilakrayal added stat:awaiting response Status - Awaiting response from author and removed awaiting review Pull request awaiting review labels Jun 12, 2024
Copy link

This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Jun 20, 2024
Copy link

This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further.

Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:ops OPs related issues stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author TF 2.15 For issues related to 2.15.x type:bug Bug
Projects
None yet
Development

No branches or pull requests

3 participants