Skip to content

tf.raw.ops.ResourceApplyGradientDescent aborts with internal CHECK failure on dtype mismatch instead of raising an error #113074

Description

@DeLightor

Issue type

Bug

Have you reproduced the bug with TensorFlow Nightly?

No

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

No response

GPU model and memory

4 x NVIDIA GeForce RTX 2080 Ti, 11264 MiB each

Current behavior?

Current behavior

tf.raw_ops.ResourceApplyGradientDescent aborts the process with a fatal internal CHECK failure when the resource variable dtype does not match the alpha / delta dtype.

Observed fatal error:

F0000 tensor.cc:896 float expected, got bfloat16

This appears to be a dtype-validation robustness bug. A mismatched dtype should be rejected with a normal recoverable TensorFlow exception such as InvalidArgumentError, rather than terminating the entire process.

##Expected behavior
tf.raw_ops.ResourceApplyGradientDescent should validate dtype consistency and return a regular TensorFlow exception instead of aborting the process with an internal CHECK failure.

Minimal reproducer

import tensorflow as tf

var = tf.Variable(tf.zeros([2, 2], dtype=tf.bfloat16), trainable=True)

alpha = tf.constant(0.1, dtype=tf.float32)
delta = tf.constant([[0.1, 0.2], [0.3, 0.4]], dtype=tf.float32)

tf.raw_ops.ResourceApplyGradientDescent(
    var=var.handle,
    alpha=alpha,
    delta=delta,
    use_locking=False,
)

### Standalone code to reproduce the issue

```shell
Environment
Ubuntu 24.04.3 LTS x86_64
Python 3.10
TensorFlow 2.21.0
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_ResourceApplyGradientDescent/2.py
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1774271752.143030 3736869 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:1774271752.208604 3736869 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:1774271753.559399 3736869 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:1774271755.104253 3736869 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:1774271755.105709 3736869 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:1774271755.107210 3736869 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:1774271755.108650 3736869 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
Error with alpha: 0.100098, delta: [[0.100098 0.200195]
 [0.300781 0.400391]]: Cannot assign a device for operation ResourceApplyGradientDescent: Could not satisfy explicit device specification '/job:localhost/replica:0/task:0/device:GPU:0' because no supported kernel for GPU devices is available.
Colocation Debug Info:
Colocation group had the following types and supported devices: 
Root Member(assigned_device_name_index_=1 requested_device_name_='/job:localhost/replica:0/task:0/device:GPU:0' assigned_device_name_='/job:localhost/replica:0/task:0/device:GPU:0' resource_device_name_='/job:localhost/replica:0/task:0/device:GPU:0' supported_device_types_=[CPU] possible_devices_=[]
ResourceApplyGradientDescent: CPU 
_Arg: GPU CPU 

Colocation members, user-requested devices, and framework assigned devices, if any:
  var (_Arg)  framework assigned device=/job:localhost/replica:0/task:0/device:GPU:0
  ResourceApplyGradientDescent (ResourceApplyGradientDescent) /job:localhost/replica:0/task:0/device:GPU:0

Op: ResourceApplyGradientDescent
Node attrs: use_locking=false, T=DT_BFLOAT16
Registered kernels:
  device='XLA_CPU_JIT'; T in [DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_BFLOAT16, DT_COMPLEX128, DT_HALF]
  device='XLA_GPU_JIT'; T in [DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_BFLOAT16, DT_COMPLEX128, DT_HALF]
  device='CPU'; T in [DT_COMPLEX128]
  device='CPU'; T in [DT_COMPLEX64]
  device='CPU'; T in [DT_DOUBLE]
  device='CPU'; T in [DT_FLOAT]
  device='CPU'; T in [DT_BFLOAT16]
  device='CPU'; T in [DT_HALF]
  device='GPU'; T in [DT_COMPLEX128]
  device='GPU'; T in [DT_COMPLEX64]
  device='GPU'; T in [DT_DOUBLE]
  device='GPU'; T in [DT_FLOAT]
  device='GPU'; T in [DT_HALF]

         [[{{node ResourceApplyGradientDescent}}]] [Op:ResourceApplyGradientDescent] name: 
F0000 00:00:1774271755.384332 3736869 tensor.cc:896] Check failed: dtype() == expected_dtype (14 vs. 1)  float expected, got bfloat16
*** Check failure stack trace: ***
    @     0x74021b51d314  absl::lts_20250814::log_internal::LogMessage::SendToLog()
    @     0x74021b51d296  absl::lts_20250814::log_internal::LogMessage::Flush()
    @     0x74021b0f1fa2  tensorflow::Tensor::CheckTypeAndIsAligned()
    @     0x7401ff819e5d  tensorflow::ApplyGradientDescentOp<>::Compute()
    @     0x74021b5876bc  tensorflow::BaseGPUDevice::Compute()
    @     0x74021900e778  tensorflow::(anonymous namespace)::SingleThreadedExecutorImpl::Run()
    @     0x740218fdb99d  tensorflow::FunctionLibraryRuntimeImpl::RunSync()
    @     0x740218fe6c26  tensorflow::ProcessFunctionLibraryRuntime::RunMultiDeviceSync()
    @     0x740218fecc60  tensorflow::ProcessFunctionLibraryRuntime::RunSync()
    @     0x740211bf119d  tensorflow::KernelAndDeviceFunc::Run()
    @     0x740211ba00fb  tensorflow::EagerKernelExecute()
    @     0x740211ba981e  tensorflow::ExecuteNode::Run()
    @     0x74021216f7b4  tensorflow::EagerExecutor::SyncExecute()
    @     0x740211b9faa1  tensorflow::(anonymous namespace)::EagerLocalExecute()
    @     0x740211b9d1d0  tensorflow::DoEagerExecute()
    @     0x740211ba0b2b  tensorflow::EagerExecute()
    @     0x7402116ce247  tensorflow::EagerOperation::Execute()
    @     0x740211bedbb7  tensorflow::CustomDeviceOpHandler::Execute()
    @     0x74020ed004e5  TFE_Execute
    @     0x7401dea9f910  TFE_Py_FastPathExecute_C()
    @     0x7401dd5dcc53  pybind11::detail::argument_loader<>::call<>()
    @     0x7401dd5dcb8c  pybind11::cpp_function::initialize<>()::{lambda()#1}::__invoke()
    @     0x7401dd5b3fdd  pybind11::cpp_function::dispatcher()
    @     0x5a62e3af90c6  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. Kayyuri commented on Mar 27, 2026

    @Kayyuri

    @Venkat6871 , I’ve confirmed that this crash occurs in both TensorFlow 2.21 and tf-nightly when using tf.raw_ops.ResourceApplyGradientDescent with mismatched dtype, instead of raising an InvalidArgumentError . I am attaching the gist file for the reference.
    Thanks!

  4. self-assigned this
    on Mar 27, 2026
  5. added 2 commits that reference this issue on Jul 29, 2026
    70aca0d
    e10ada5
  6. added a commit that references this issue on Sep 3, 2026
    0f7fd04
  7. removed
    awaiting PR merge
    on Oct 9, 2026
  8. Kayyuri commented on Oct 9, 2026

    @Kayyuri

    Hi @DeLightor,
    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!

  9. added
    stat:contribution welcome
    on Oct 9, 2026
  10. added
    awaiting PR merge
    and removed
    stat:contribution welcome
    on Oct 19, 2026
  11. Venkat6871 commented on Nov 5, 2026

    @Venkat6871
    Contributor

    Hi @DeLightor ,
    Thank you for raising your concern here.
    A fix for this issue has been proposed in this PR. Once it is merged, this issue will be resolved.

    Hi @vishwakt ,
    Thank you for raising the PR to address this issue. We truly appreciate your initiative and the effort in contributing the fix.

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