tensorflow / tensorflow/tensorflow

tf.image.combined_non_max_suppression aborts process on wrong-rank inputs (should raise Python exception instead)

Open
#99,583 2 comments 0 reactions 1 assignee View on GitHub

@Venkat6871 is already working on this.

Since Sep 1, 2025.

awaiting PR merge comp:ops TF 2.19 type:bug
Dominant language
C++
Stars
200k
Forks
76.9k
Avg merge
2d 3h
Merged PRs (30d)
433

Description

Issue type

Bug

Have you reproduced the bug with TensorFlow Nightly?

No

Source

binary

TensorFlow version

tensorflow version: 2.20.0

Custom code

Yes

OS platform and distribution

Ubuntu 22.04.4 LTS (x86_64)

Mobile device

Ubuntu 22.04.4 LTS (x86_64)

Python version

3.10.16

Bazel version

bazel 8.3.1

GCC/compiler version

clang-18.1.8

CUDA/cuDNN version

12.5.1/9.3.0

GPU model and memory

NVIDIA RTX A6000 49140MiB

Current behavior?

Running the above script causes a fatal C++ abort instead of raising a Python exception

Standalone code to reproduce the issue
import tensorflow as tf
print("TF version:", tf.__version__)

# Wrong-rank inputs
# Expected: boxes rank=4, scores rank=3
boxes  = tf.random.uniform([4, 10, 4], dtype=tf.float32)   # rank=3
scores = tf.random.uniform([4, 10],    dtype=tf.float32)   # rank=2

print("About to call combined_non_max_suppression with wrong-rank inputs...")
try:
    out = tf.image.combined_non_max_suppression(
        boxes=boxes,
        scores=scores,
        max_output_size_per_class=100,
        max_total_size=100,
        iou_threshold=0.5,
        score_threshold=0.5,
        clip_boxes=True,
        pad_per_class=False,
    )
    print("Unexpectedly succeeded. Output shapes:", [t.shape for t in out])
except Exception as e:
    print("Caught Python-level exception instead of abort:", repr(e))

print("Done.")
Relevant log output
About to call combined_non_max_suppression with wrong-rank inputs...
2025-09-01 16:55:46.516023: F tensorflow/core/framework/tensor_shape.cc:359] 
Check failed: d < dims() (2 vs. 2)
Aborted (core dumped)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.