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

Method _Run

tensorflow/compiler/tests/jit_test.py:432–458  ·  view source on GitHub ↗
(compiled)

Source from the content-addressed store, hash-verified

430 """Tests that the backprop function is properly compiled."""
431
432 def _Run(compiled):
433
434 @function.Defun(compiled=compiled)
435 def Forward(x):
436 return math_ops.log(x)
437
438 g = ops.Graph()
439 with g.as_default():
440 x = array_ops.placeholder(dtypes.float32)
441 y = Forward(x)
442 dx, = gradients_impl.gradients(y, [x], 1.0)
443
444 cfg = NoRewriteSessionConfig()
445 cfg.graph_options.optimizer_options.opt_level = (
446 config_pb2.OptimizerOptions.L1)
447 cfg.graph_options.optimizer_options.do_function_inlining = True
448 with session_lib.Session(graph=g, config=cfg) as sess:
449 run_metadata = config_pb2.RunMetadata()
450 dx_val = test_utils.RunWithWarmup(
451 sess,
452 dx,
453 feed_dict={x: 100.},
454 run_metadata=run_metadata,
455 options=config_pb2.RunOptions(
456 trace_level=config_pb2.RunOptions.FULL_TRACE))
457 self.assertAllClose(dx_val, 0.01)
458 return RunMetadataLabels(run_metadata)
459
460 # SymGrad[f=log(x)](x, dy) = 1/x * dy
461 #

Callers

nothing calls this directly

Calls 8

as_defaultMethod · 0.95
NoRewriteSessionConfigFunction · 0.85
RunMetadataLabelsFunction · 0.85
RunMetadataMethod · 0.80
GraphMethod · 0.45
placeholderMethod · 0.45
SessionMethod · 0.45
assertAllCloseMethod · 0.45

Tested by

no test coverage detected