From f44bcfbea9abb7bf1d684a3df0ed73f94a692b9e Mon Sep 17 00:00:00 2001 From: Gaurav Jain Date: Tue, 2 Apr 2019 16:04:19 -0700 Subject: [PATCH] Fix dtype check in GradientTape ResourceVariables handles will have Tensor type as dtype.resource. Instead, we should check the dtype of the Variable Tensor. PiperOrigin-RevId: 241623008 --- tensorflow/python/eager/backprop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/python/eager/backprop.py b/tensorflow/python/eager/backprop.py index 2654ad419fa..0a25487e792 100644 --- a/tensorflow/python/eager/backprop.py +++ b/tensorflow/python/eager/backprop.py @@ -957,7 +957,7 @@ class GradientTape(object): flat_sources = nest.flatten(sources) flat_sources_raw = flat_sources flat_sources = [_handle_or_self(x) for x in flat_sources] - for t in flat_sources: + for t in flat_sources_raw: if not t.dtype.is_floating: logging.vlog( logging.WARN, "The dtype of the source tensor must be "