MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / testGradients

Method testGradients

tensorflow/python/kernel_tests/cast_op_test.py:205–214  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

203
204 @test_util.run_deprecated_v1
205 def testGradients(self):
206 t = [dtypes.float32, dtypes.float64, dtypes.complex64, dtypes.complex128]
207 for src_t in t:
208 for dst_t in t:
209 with self.cached_session():
210 x = constant_op.constant(1.0, src_t)
211 z = array_ops.identity(x)
212 y = math_ops.cast(z, dst_t)
213 err = gradient_checker.compute_gradient_error(x, [], y, [])
214 self.assertLess(err, 1e-3)
215
216
217class SparseTensorCastTest(test.TestCase):

Callers

nothing calls this directly

Calls 4

cached_sessionMethod · 0.45
constantMethod · 0.45
identityMethod · 0.45
castMethod · 0.45

Tested by

no test coverage detected