Skip to content

Segmentation Fault in tf.raw_ops.QuantizeAndDequantizeV3 #94116

Closed

Description

@SilentTester73

Issue type

Bug

Have you reproduced the bug with TensorFlow Nightly?

Yes

Source

binary

TensorFlow version

2.20.0-dev20250516 (git: v1.12.1-126285-g20148f52365)

Custom code

Yes

OS platform and distribution

Linux (CPU execution)

Mobile device

No response

Python version

3.12.3

Bazel version

No response

GCC/compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

tf.raw_ops.QuantizeAndDequantizeV3 crashes with a segmentation fault due to a tensor shape validation failure. The crash occurs in tensor_shape.cc with a bounds checking assertion failure when processing negative axis values. The code may lack proper validation of axis parameters before processing.

Colab reproduction link: https://colab.research.google.com/drive/19QlV0TIQqkN_S66VATzOX_-vkTyg4I9K?usp=sharing

Standalone code to reproduce the issue

import tensorflow as tf
import numpy as np

# Create input tensor with extreme values
input_tensor = tf.constant([
    [[4.3136053036349129e-244, 1.2524328545813582e-21, 7.71590127777328e+26, 1.0, 2.0, 3.0],
     [1e-100, 1e+100, -1e+50, 4.0, 5.0, 6.0]]
], dtype=tf.float64)  # Shape [1, 2, 6]

# Extreme range values
input_min = tf.constant(-5.4785109376353583e-282, dtype=tf.float64)
input_max = tf.constant(1.4455588399771524e+73, dtype=tf.float64)
num_bits = tf.constant(2, dtype=tf.int32)

# This crashes with segfault
result = tf.raw_ops.QuantizeAndDequantizeV3(
    input=input_tensor,
    input_min=input_min,
    input_max=input_max,
    num_bits=num_bits,
    signed_input=False,
    range_given=True,
    narrow_range=True,
    axis=-2  # Negative axis triggers the crash
)

Relevant log output

2025-05-24 16:12:02.945026: F tensorflow/core/framework/tensor_shape.cc:358] Check failed: d >= 0 (0 vs. -2)
Aborted (core dumped)

Activity

  1. Venkat6871 commented on May 27, 2025

    @Venkat6871
    Contributor

    I was able to reproduce the same issue using TensorFlow 2.19.0 as well as the nightly version. Please find the Gist for your reference.
    Thank you!

  2. Venkat6871 commented on Mar 24, 2026

    @Venkat6871
    Contributor

    Hi @SilentTester73 ,
    Thank you so much for filing this issue. We truly appreciate your support. At the moment, this request is not prioritized and mark it for community contributions. If you would like to contribute on a fix, please feel free to fork the repository and submit a pull request in accordance with the TensorFlow CONTRIBUTION GUIDELINES and link this issue in your PR to ensure the maintainers can easily review and collaborate.
    To avoid duplicate work, please leave a comment here if you decide to take it on!

    Thank you again for your interest and we look forward to seeing your contributions!

  3. added
    stat:contribution welcome
    on Mar 24, 2026
  4. removed
    stat:contribution welcome
    on Jun 23, 2026
  5. Venkat6871 commented on Jun 23, 2026

    @Venkat6871
    Contributor

    Hi,

    Thank you for opening this issue. Since this issue has been open for a long time, the code/debug information for this issue may not be relevant with the current state of the code base.

    Based on the example provided, invoking tf.raw_ops.QuantizeAndDequantizeV3 with a negative axis value results in a fatal check failure (Check failed: d >= 0 (0 vs. -2)) and process termination. The reported reproducer passes axis=-2, which leads to the observed failure during tensor shape processing.

    The Tensorflow team is constantly improving the framework by fixing bugs and adding new features. We suggest you try the latest TensorFlow version with the latest compatible hardware configuration which could potentially resolve the issue. If you are still facing the issue, please create a new GitHub issue with your latest findings, with all the debugging information which could help us investigate.

    Please follow the release notes to stay up to date with the latest developments which are happening in the Tensorflow space.

  6. added
    stat:awaiting response
    on Jun 23, 2026
  7. github-actions commented on Jul 1, 2026

    @github-actions

    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.

  8. added
    stale
    on Jul 1, 2026
  9. github-actions commented on Jul 9, 2026

    @github-actions

    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.

  10. google-ml-butler commented on Jul 9, 2026

    @google-ml-butler

    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

Metadata

Metadata

Assignees

Labels

TF 2.19comp:opsstalestat:awaiting responsetype:bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions