- Notifications
You must be signed in to change notification settings - Fork75.1k
Open
Description
Issue type
Bug
Have you reproduced the bug with TensorFlow Nightly?
Yes
Source
source
TensorFlow version
tf 2.19
Custom code
Yes
OS platform and distribution
No response
Mobile device
No response
Python version
No response
Bazel version
No response
GCC/compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current behavior?
When callingtf.raw_ops.BlockLSTMGradV2 with aseq_len_max value larger than the actual time dimension of inputs, the process crashes (segmentation fault) instead of raising a Python exception.
The following code would crash ontf 2.19. To reproduce the issue, I provided that acolab notebook to reproduce the error.
Standalone code to reproduce the issue
import tensorflow as tfimport numpy as npseq_len_max = 3batch_size = 2input_size = 4num_units = 5x = tf.constant(np.random.randn(seq_len_max - 1, batch_size, input_size).astype(np.float32))# x: (2,2,4), seq_len_max:3cs_prev = tf.constant(np.random.randn(batch_size, num_units).astype(np.float32))h_prev = tf.constant(np.random.randn(batch_size, num_units).astype(np.float32))w = tf.constant(np.random.randn(input_size + num_units, 4* num_units).astype(np.float32))wci = tf.constant(np.random.randn(num_units).astype(np.float32))wcf = tf.constant(np.random.randn(num_units).astype(np.float32))wco = tf.constant(np.random.randn(num_units).astype(np.float32))b = tf.constant(np.random.randn(4* num_units).astype(np.float32))i = tf.constant(np.random.randn(seq_len_max - 1, batch_size, num_units).astype(np.float32))cs = tf.constant(np.random.randn(seq_len_max - 1, batch_size, num_units).astype(np.float32))f = tf.constant(np.random.randn(seq_len_max - 1, batch_size, num_units).astype(np.float32))o = tf.constant(np.random.randn(seq_len_max - 1, batch_size, num_units).astype(np.float32))ci = tf.constant(np.random.randn(seq_len_max - 1, batch_size, num_units).astype(np.float32))co = tf.constant(np.random.randn(seq_len_max - 1, batch_size, num_units).astype(np.float32))h = tf.constant(np.random.randn(seq_len_max - 1, batch_size, num_units).astype(np.float32))cs_grad = tf.constant(np.random.randn(seq_len_max - 1, batch_size, num_units).astype(np.float32))h_grad = tf.constant(np.random.randn(seq_len_max - 1, batch_size, num_units).astype(np.float32))use_peephole = Trueresult = tf.raw_ops.BlockLSTMGradV2( seq_len_max=seq_len_max,# seq_len_max:3 x=x,# x: (2,2,4) cs_prev=cs_prev, h_prev=h_prev, w=w, wci=wci, wcf=wcf, wco=wco, b=b, i=i, cs=cs, f=f, o=o, ci=ci, co=co, h=h, cs_grad=cs_grad, h_grad=h_grad, use_peephole=use_peephole)
Relevant log output
2025-12-17 11:28:27.238936: F tensorflow/core/framework/tensor.cc:1078] Check failed: limit<= dim0_size (3 vs. 2)[1] 2650852 abort (core dumped)