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

Method testContext

tensorflow/python/grappler/cluster_test.py:116–131  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

114 self.assertEqual(7680.0, estimated_perf)
115
116 def testContext(self):
117 with ops.Graph().as_default() as g:
118 a = random_ops.random_uniform(shape=())
119 b = random_ops.random_uniform(shape=())
120 c = a + b
121 train_op = ops.get_collection_ref(ops.GraphKeys.TRAIN_OP)
122 train_op.append(c)
123 mg = meta_graph.create_meta_graph_def(graph=g)
124 grappler_item = item.Item(mg)
125
126 with cluster.Provision(
127 disable_detailed_stats=False, disable_timeline=False) as gcluster:
128 op_perfs, run_time, step_stats = gcluster.MeasureCosts(grappler_item)
129 self.assertTrue(run_time > 0)
130 self.assertEqual(len(op_perfs), 4)
131 self.assertTrue(step_stats.dev_stats)
132
133 def testAvailableOps(self):
134 with cluster.Provision() as gcluster:

Callers

nothing calls this directly

Calls 8

random_uniformMethod · 0.80
get_collection_refMethod · 0.80
ItemMethod · 0.80
MeasureCostsMethod · 0.80
as_defaultMethod · 0.45
GraphMethod · 0.45
appendMethod · 0.45
ProvisionMethod · 0.45

Tested by

no test coverage detected