Skip to content

tf.raw.ops.LSTMBlockCellGrad aborts with internal CHECK failure on invalid-rank input instead of raising an error #113071

Closed

Description

@DeLightor

Issue type

Bug

Have you reproduced the bug with TensorFlow Nightly?

Yes

Source

source

TensorFlow version

tf 2.21.0

Custom code

Yes

OS platform and distribution

Ubuntu 24.04.3 LTS x86_64

Mobile device

No response

Python version

3.10.20

Bazel version

No response

GCC/compiler version

No response

CUDA/cuDNN version

NVIDIA driver version: 580.126.09

GPU model and memory

4 x NVIDIA GeForce RTX 2080 Ti, 11264 MiB each

Current behavior?

Current behavior

tf.raw_ops.LSTMBlockCellGrad aborts the entire process with a fatal internal CHECK failure when given malformed input rank, instead of raising a normal recoverable TensorFlow exception.

Observed fatal error:

F0000 tensor_shape.cc:47 Check failed: NDIMS == dims() (2 vs. 3)

This appears to be an input-validation robustness bug. Invalid-rank inputs should be rejected gracefully with a regular TensorFlow error such as InvalidArgumentError, rather than terminating the process.

Expected behavior

Malformed inputs should produce a regular TensorFlow exception rather than a fatal internal CHECK abort.

Minimal reproducer

import tensorflow as tf

with tf.device('/GPU:0'):
    shape = (0, 0, 0)
    dtype = tf.float16

    x = tf.random.uniform(shape, dtype=dtype)
    cs_prev = tf.random.uniform(shape, dtype=dtype)
    h_prev = tf.random.uniform(shape, dtype=dtype)
    w = tf.random.uniform((0, 0), dtype=dtype)
    wci = tf.random.uniform((0,), dtype=dtype)
    wcf = tf.random.uniform((0,), dtype=dtype)
    wco = tf.random.uniform((0,), dtype=dtype)
    b = tf.random.uniform((0,), dtype=dtype)
    i = tf.random.uniform(shape, dtype=dtype)
    cs = tf.random.uniform(shape, dtype=dtype)
    f = tf.random.uniform(shape, dtype=dtype)
    o = tf.random.uniform(shape, dtype=dtype)
    ci = tf.random.uniform(shape, dtype=dtype)
    co = tf.random.uniform(shape, dtype=dtype)
    cs_grad = tf.random.uniform(shape, dtype=dtype)
    h_grad = tf.random.uniform(shape, dtype=dtype)

    tf.raw_ops.LSTMBlockCellGrad(
        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,
        cs_grad=cs_grad,
        h_grad=h_grad,
        use_peephole=False,
    )

### Standalone code to reproduce the issue

```shell
Environment
Linux x86_64
Python 3.10
TensorFlow 2.21.0
GPU-enabled TensorFlow runtime
Reproduced in local conda environment: tf_test

conda run --no-capture-output -n tf_test python repro.py

Relevant log output

(tf_test) user@user-Standard-PC-Q35-ICH9-2009:/home/lhj$ python /home/lhj/callChainBuild/src_tensorflow/output_tensorflow/targeted_mutation/generated_code/tf/tf_raw_ops_LSTMBlockCellGrad/0.py
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1774271038.290252 3735934 port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
I0000 00:00:1774271038.363781 3735934 cpu_feature_guard.cc:227] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1774271039.742877 3735934 port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
I0000 00:00:1774271041.343926 3735934 gpu_device.cc:2043] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 9606 MB memory:  -> device: 0, name: NVIDIA GeForce RTX 2080 Ti, pci bus id: 0000:01:00.0, compute capability: 7.5
I0000 00:00:1774271041.345581 3735934 gpu_device.cc:2043] Created device /job:localhost/replica:0/task:0/device:GPU:1 with 9606 MB memory:  -> device: 1, name: NVIDIA GeForce RTX 2080 Ti, pci bus id: 0000:02:00.0, compute capability: 7.5
I0000 00:00:1774271041.347167 3735934 gpu_device.cc:2043] Created device /job:localhost/replica:0/task:0/device:GPU:2 with 9606 MB memory:  -> device: 2, name: NVIDIA GeForce RTX 2080 Ti, pci bus id: 0000:03:00.0, compute capability: 7.5
I0000 00:00:1774271041.348591 3735934 gpu_device.cc:2043] Created device /job:localhost/replica:0/task:0/device:GPU:3 with 9606 MB memory:  -> device: 3, name: NVIDIA GeForce RTX 2080 Ti, pci bus id: 0000:04:00.0, compute capability: 7.5
E0000 00:00:1774271041.608835 3735934 util.cc:131] oneDNN supports DT_HALF only on platforms with AVX-512. Falling back to the default Eigen-based implementation if present.
Success for shape (0, 0) and dtype <dtype: 'float16'>: LSTMBlockCellGrad(cs_prev_grad=<tf.Tensor: shape=(0, 0), dtype=float16, numpy=array([], shape=(0, 0), dtype=float16)>, dicfo=<tf.Tensor: shape=(0, 0), dtype=float16, numpy=array([], shape=(0, 0), dtype=float16)>, wci_grad=<tf.Tensor: shape=(0,), dtype=float16, numpy=array([], dtype=float16)>, wcf_grad=<tf.Tensor: shape=(0,), dtype=float16, numpy=array([], dtype=float16)>, wco_grad=<tf.Tensor: shape=(0,), dtype=float16, numpy=array([], dtype=float16)>)
Success for shape (0, 0) and dtype <dtype: 'float32'>: LSTMBlockCellGrad(cs_prev_grad=<tf.Tensor: shape=(0, 0), dtype=float32, numpy=array([], shape=(0, 0), dtype=float32)>, dicfo=<tf.Tensor: shape=(0, 0), dtype=float32, numpy=array([], shape=(0, 0), dtype=float32)>, wci_grad=<tf.Tensor: shape=(0,), dtype=float32, numpy=array([], dtype=float32)>, wcf_grad=<tf.Tensor: shape=(0,), dtype=float32, numpy=array([], dtype=float32)>, wco_grad=<tf.Tensor: shape=(0,), dtype=float32, numpy=array([], dtype=float32)>)
Error for shape (0, 0) and dtype <dtype: 'float64'>: Value for attr 'T' of double is not in the list of allowed values: half, float
        ; NodeDef: {{node LSTMBlockCellGrad}}; Op<name=LSTMBlockCellGrad; signature=x:T, cs_prev:T, h_prev:T, w:T, wci:T, wcf:T, wco:T, b:T, i:T, cs:T, f:T, o:T, ci:T, co:T, cs_grad:T, h_grad:T -> cs_prev_grad:T, dicfo:T, wci_grad:T, wcf_grad:T, wco_grad:T; attr=use_peephole:bool; attr=T:type,allowed=[DT_HALF, DT_FLOAT]> [Op:LSTMBlockCellGrad] name: 
Error for shape (0,) and dtype <dtype: 'float16'>: tuple index out of range
Error for shape (0,) and dtype <dtype: 'float32'>: tuple index out of range
Error for shape (0,) and dtype <dtype: 'float64'>: tuple index out of range
F0000 00:00:1774271041.623905 3735934 tensor_shape.cc:47] Check failed: NDIMS == dims() (2 vs. 3) Asking for tensor of 2 dimensions from a tensor of 3 dimensions
*** Check failure stack trace: ***
    @     0x74dfa371d314  absl::lts_20250814::log_internal::LogMessage::SendToLog()
    @     0x74dfa371d296  absl::lts_20250814::log_internal::LogMessage::Flush()
    @     0x74dfa334c870  tensorflow::TensorShape::CheckDimsEqual()
    @     0x74dfa3192a5d  tensorflow::Tensor::tensor<>()
    @     0x74df8715173d  tensorflow::LSTMBlockCellGradOp<>::Compute()
    @     0x74dfa37876bc  tensorflow::BaseGPUDevice::Compute()
    @     0x74dfa120e778  tensorflow::(anonymous namespace)::SingleThreadedExecutorImpl::Run()
    @     0x74dfa11db99d  tensorflow::FunctionLibraryRuntimeImpl::RunSync()
    @     0x74dfa11e6c26  tensorflow::ProcessFunctionLibraryRuntime::RunMultiDeviceSync()
    @     0x74dfa11ecc60  tensorflow::ProcessFunctionLibraryRuntime::RunSync()
    @     0x74df99df119d  tensorflow::KernelAndDeviceFunc::Run()
    @     0x74df99da00fb  tensorflow::EagerKernelExecute()
    @     0x74df99da981e  tensorflow::ExecuteNode::Run()
    @     0x74df9a36f7b4  tensorflow::EagerExecutor::SyncExecute()
    @     0x74df99d9faa1  tensorflow::(anonymous namespace)::EagerLocalExecute()
    @     0x74df99d9d1d0  tensorflow::DoEagerExecute()
    @     0x74df99da0b2b  tensorflow::EagerExecute()
    @     0x74df998ce247  tensorflow::EagerOperation::Execute()
    @     0x74df99dedbb7  tensorflow::CustomDeviceOpHandler::Execute()
    @     0x74df96f004e5  TFE_Execute
    @     0x74df66c9f910  TFE_Py_FastPathExecute_C()
    @     0x74df657dcc53  pybind11::detail::argument_loader<>::call<>()
    @     0x74df657dcb8c  pybind11::cpp_function::initialize<>()::{lambda()#1}::__invoke()
    @     0x74df657b3fdd  pybind11::cpp_function::dispatcher()
    @     0x59ef3117f0c6  cfunction_call
Aborted (core dumped)

Activity

  1. self-assigned this
    on Mar 24, 2026
  2. added
    comp:ops
    comp:gpu
    2.21.0
    on Mar 24, 2026
  3. avmohansai commented on Mar 30, 2026

    @avmohansai

    Hi @Venkat6871 ,
    I Was able to reproduce the issue(crash) on Colab using TF v2.21.0 and TF-nightly ,Please find the gist here for reference.
    Thank you.

  4. added a commit that references this issue on Jul 29, 2026
    1e1507c
  5. added a commit that references this issue on Sep 9, 2026
    e119048
  6. added a commit that references this issue on Oct 9, 2026
    2bb2150
  7. google-ml-butler commented on Oct 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

2.21.0awaiting PR mergecomp:gpucomp:opstype:bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions