From 7fa0cf39f854d5fdaaa19ad6425dfed02f5fea64 Mon Sep 17 00:00:00 2001 From: Zader Zheng Date: Mon, 8 May 2017 08:31:50 +0800 Subject: [PATCH] =?UTF-8?q?Unveil=20type=20check=20part=20in=20=5FVerifyGe?= =?UTF-8?q?neratedGradients=20that=20was=20not=20actu=E2=80=A6=20(#9529)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * unveil type check part in _VerifyGeneratedGradients that was not actually used * remove the block that's not getting used --- tensorflow/python/ops/gradients_impl.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/tensorflow/python/ops/gradients_impl.py b/tensorflow/python/ops/gradients_impl.py index 2adf8f05d89..bd8a5c86acc 100644 --- a/tensorflow/python/ops/gradients_impl.py +++ b/tensorflow/python/ops/gradients_impl.py @@ -273,28 +273,6 @@ def _VerifyGeneratedGradients(grads, op): if len(grads) != len(op.inputs): raise ValueError("Num gradients %d generated for op %s do not match num " "inputs %d" % (len(grads), op.node_def, len(op.inputs))) - for i in xrange(len(grads)): - grad = grads[i] - inp = op.inputs[i] - if grad is None: - continue - if grad.dtype.is_floating: - if not inp.dtype.is_floating: - raise TypeError("Gradient type %s generated for real-valued op %s " - "with type %s must be real" % - (dtypes.as_dtype(grad.dtype).name, op.node_def, - dtypes.as_dtype(inp.dtype).name)) - elif grad.dtype.is_complex: - if not inp.dtype.is_complex: - raise TypeError("Gradient type %s generated for complex-valued op %s" - " with type %s must be complex" % - (dtypes.as_dtype(grad.dtype).name, op.node_def, - dtypes.as_dtype(inp.dtype).name)) - else: - raise TypeError("Gradient type %s generated for op %s " - "with type %s must be either real or complex" % - (dtypes.as_dtype(grad.dtype).name, op.node_def, - dtypes.as_dtype(inp.dtype).name)) def _StopOps(from_ops, pending_count):