Aborted (core dumped) in `tf.raw_ops.NearestNeighbors`
LongZE666 opened this issue · comments
LIU HAOTONG commented
Issue type
Bug
Have you reproduced the bug with TensorFlow Nightly?
Yes
Source
source
TensorFlow version
tf 2.16.1
Custom code
Yes
OS platform and distribution
Ubuntu 20.04
Mobile device
No response
Python version
3.11
Bazel version
No response
GCC/compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current behavior?
Parameter k being set to a negative number will cause a crash.
Standalone code to reproduce the issue
import tensorflow as tf
points = tf.constant(0.554979503, shape=[1000,100], dtype=tf.float32)
centers = tf.constant(0.554979503, shape=[1000,100], dtype=tf.float32)
k = tf.constant(-1250999896764, shape=[], dtype=tf.int64)
tf.raw_ops.NearestNeighbors(points=points, centers=centers, k=k)
Relevant log output
2024-05-01 03:49:00.796702: F tensorflow/core/framework/tensor_shape.cc:201] Non-OK-status: InitDims(dim_sizes) status: INVALID_ARGUMENT: Expected shape dimensions to be non-negative, got -1250999896764
Aborted (core dumped)