Repository navigation
Description
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
No response
GPU model and memory
4 x NVIDIA GeForce RTX 2080 Ti, 11264 MiB each
Current behavior?
Current behavior
I verified this issue locally by running the original reproducer in the tf_test conda environment.
tf.raw_ops.ResourceSparseApplyAdagrad aborts the process with a fatal internal CHECK failure when the resource variable dtype does not match the lr / grad dtype.
Observed fatal error:
F0000 tensor.cc:896] Check failed: dtype() == expected_dtype (1 vs. 19) half expected, got float
The process terminates with Aborted (core dumped) / exit code 134 instead of raising a normal recoverable TensorFlow exception.
This appears to be the same validation-gap family as other Resource* dtype mismatch aborts. Invalid dtype combinations should be handled as ordinary user-facing errors rather than hard process termination.
Expected behavior
tf.raw_ops.ResourceSparseApplyAdagrad should validate dtype consistency and return a regular TensorFlow exception such as InvalidArgumentError, instead of aborting the process.
Minimal reproducer
import tensorflow as tf
with tf.device('/GPU:0'):
var = tf.Variable(tf.random.uniform([3, 3], dtype=tf.float32))
accum = tf.Variable(tf.zeros([3, 3], dtype=tf.float32))
lr = tf.constant(0.1, dtype=tf.float16)
grad = tf.constant(
[[0.1, 0.2, 0.3],
[0.0, 0.0, 0.0],
[0.5, 0.5, 0.5]],
dtype=tf.float16,
)
indices = tf.constant([0, 1, 2], dtype=tf.int32)
tf.raw_ops.ResourceSparseApplyAdagrad(
var=var.handle,
accum=accum.handle,
lr=lr,
grad=grad,
indices=indices,
use_locking=False,
update_slots=True,
)
### Standalone code to reproduce the issue
```shell
Environment
Ubuntu 24.04.3 LTS 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.pyRelevant 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_ResourceSparseApplyAdagrad/0.py
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1774341178.010676 3800781 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:1774341178.070174 3800781 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:1774341179.397988 3800781 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:1774341180.571650 3800781 gpu_device.cc:2043] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 9298 MB memory: -> device: 0, name: NVIDIA GeForce RTX 2080 Ti, pci bus id: 0000:01:00.0, compute capability: 7.5
I0000 00:00:1774341180.573210 3800781 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:1774341180.574671 3800781 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:1774341180.576155 3800781 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:1774341180.790290 3800781 util.cc:131] oneDNN supports DT_HALF only on platforms with AVX-512. Falling back to the default Eigen-based implementation if present.
F0000 00:00:1774341180.791837 3800781 tensor.cc:896] Check failed: dtype() == expected_dtype (1 vs. 19) half expected, got float
*** Check failure stack trace: ***
@ 0x768dbd31d314 absl::lts_20250814::log_internal::LogMessage::SendToLog()
@ 0x768dbd31d296 absl::lts_20250814::log_internal::LogMessage::Flush()
@ 0x768dbcef1fa2 tensorflow::Tensor::CheckTypeAndIsAligned()
@ 0x768dba87be04 tensorflow::Tensor::flat_outer_dims<>()
@ 0x768da168fcbc tensorflow::SparseApplyAdagradOp<>::Compute()
@ 0x768dbd3876bc tensorflow::BaseGPUDevice::Compute()
@ 0x768dbae0e778 tensorflow::(anonymous namespace)::SingleThreadedExecutorImpl::Run()
@ 0x768dbaddb99d tensorflow::FunctionLibraryRuntimeImpl::RunSync()
@ 0x768dbade6c26 tensorflow::ProcessFunctionLibraryRuntime::RunMultiDeviceSync()
@ 0x768dbadecc60 tensorflow::ProcessFunctionLibraryRuntime::RunSync()
@ 0x768db39f119d tensorflow::KernelAndDeviceFunc::Run()
@ 0x768db39a00fb tensorflow::EagerKernelExecute()
@ 0x768db39a981e tensorflow::ExecuteNode::Run()
@ 0x768db3f6f7b4 tensorflow::EagerExecutor::SyncExecute()
@ 0x768db399faa1 tensorflow::(anonymous namespace)::EagerLocalExecute()
@ 0x768db399d1d0 tensorflow::DoEagerExecute()
@ 0x768db39a0b2b tensorflow::EagerExecute()
@ 0x768db34ce247 tensorflow::EagerOperation::Execute()
@ 0x768db39edbb7 tensorflow::CustomDeviceOpHandler::Execute()
@ 0x768db0b004e5 TFE_Execute
@ 0x768d8089f910 TFE_Py_FastPathExecute_C()
@ 0x768d7f3dcc53 pybind11::detail::argument_loader<>::call<>()
@ 0x768d7f3dcb8c pybind11::cpp_function::initialize<>()::{lambda()#1}::__invoke()
@ 0x768d7f3b3fdd pybind11::cpp_function::dispatcher()
@ 0x6135cc6480c6 cfunction_call
Aborted (core dumped)
Activity
avmohansai commentedon Mar 30, 2026
Hi @Venkat6871 ,
I Was able to reproduce the issue(crash) on Colab using
TF v2.21.0andTF-nightly,Please find the gist here for reference.Thank you.
fix: reject resource variable dtype mismatch in training ops
fix: reject resource variable dtype mismatch in training ops
fix: reject resource variable dtype mismatch in training ops
google-ml-butler commentedon Oct 16, 2026
Are you satisfied with the resolution of your issue?
Yes
No
Fix fatal process abort on resource variable dtype mismatch in traini…