Repository navigation
Closed
Labels
Description
Issue type
Bug
Have you reproduced the bug with TensorFlow Nightly?
Yes
Source
source
TensorFlow version
tensorflow==2.20.0
Custom code
Yes
OS platform and distribution
Kali Linux (kali-rolling) Linux kernel: 6.11.2-amd64
Mobile device
Not applicable (running on VMware VM)
Python version
3.10
Bazel version
No response
GCC/compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current behavior?
Running TensorFlow on a CPU-only VMware virtual machine produces a native segmentation fault.
Before the crash, TensorFlow attempts to initialize CUDA (cuInit), which fails with error 303:
E cuda_platform.cc:50] failed call to cuInit: INTERNAL: CUDA error: UNKNOWN ERROR (303)
Immediately after this message, Python terminates with:
zsh: segmentation fault python q1.py
No Python stack trace is shown. This is a native C++ runtime crash.
The same behavior occurs with both stable TensorFlow (2.20.0) and tf-nightly.
Standalone code to reproduce the issue
import tensorflow as tf
seq_len_max = tf.constant(1, dtype=tf.int64)
# shapes: time=1, batch=1, input=1, cell=1
x = tf.constant([[[1.0]]], dtype=tf.float32) # [time, batch, input]
cs_prev = tf.constant([[1.0]], dtype=tf.float32) # [batch, cell]
h_prev = tf.constant([[1.0]], dtype=tf.float32) # [batch, cell]
w = tf.constant([[1.0]], dtype=tf.float32) # rank-2 weight placeholder
wci = tf.constant([1.0], dtype=tf.float32) # [cell]
wcf = tf.constant([1.0], dtype=tf.float32)
wco = tf.constant([1.0], dtype=tf.float32)
b = tf.constant([1.0], dtype=tf.float32)
# gate/state tensors: [time, batch, cell]
i = tf.constant([[[1.0]]], dtype=tf.float32)
cs = tf.constant([[[1.0]]], dtype=tf.float32)
f = tf.constant([[[1.0]]], dtype=tf.float32)
o = tf.constant([[[1.0]]], dtype=tf.float32)
ci = tf.constant([[[1.0]]], dtype=tf.float32)
co = tf.constant([[[1.0]]], dtype=tf.float32)
h = tf.constant([[[1.0]]], dtype=tf.float32)
cs_grad = tf.constant([[[1.0]]], dtype=tf.float32)
h_grad = tf.constant([[[1.0]]], dtype=tf.float32)
result = tf.raw_ops.BlockLSTMGradV2(seq_len_max=seq_len_max, x=x, 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=True)
print(result)Relevant log output
Same behavior reproduced with tf-nightly before crashing:
E cuda_platform.cc:50] failed call to cuInit: INTERNAL: CUDA error: UNKNOWN ERROR (303)
zsh: segmentation fault python q1.py
Activity
Kayyuri commentedon Jul 20, 2026
Hi @moyudadi,
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!
hunterkritik-byte commentedon Aug 11, 2026
Root Cause Analysis
When invoking
tf.raw_ops.BlockLSTMGrad/tf.raw_ops.BlockLSTMGradV2with mismatched tensor dimensions (such as passing a weight matrixwof shape[1, 1]wheninput_size=1andcell_size=1),BlockLSTMGradOp::Computedoes not enforce strict shape compatibility checks on the weight tensorwand gate inputs relative toinput_sizeandcell_size.Technical Details
Expected Tensor Dimensions:
[seq_len, batch_size, input_size]and hidden cell state of sizecell_size, the concatenated transformation weight matrix[input_size + cell_size, 4 * cell_size]to accommodate the 4 LSTM gates (input_size = 1andcell_size = 1, which strictly requires[2, 4]. However,[1, 1].Memory Safety Violation:
BlockLSTMGradOp::Computelacks an explicitOP_REQUIREScheck validating thatw.dim_size(0) == input_size + cell_sizeandw.dim_size(1) == 4 * cell_size, execution proceeds to the kernel functor.TensorAdd/ tensor contractions) execute inside the kernel worker threads, Eigen attempts to access out-of-bounds memory beyond the allocated buffer forw.SIGSEGVsegmentation fault insideEigen::ThreadPoolDevice::parallelForrather than raising a cleanInvalidArgumentError.Proposed Fix
Add explicit input tensor shape validation checks in
BlockLSTMGradOp::Computeprior to kernel execution:w.dim_size(0) == input_size + cell_sizew.dim_size(1) == 4 * cell_sizecell_sizeandbatch_sizeFix integer truncation and SIGSEGV in BlockLSTMGrad kernel (#104830)
google-ml-butler commentedon Aug 24, 2026
Are you satisfied with the resolution of your issue?
Yes
No