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

Method _build_graph

tensorflow/python/client/session_test.py:1143–1160  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1141
1142 @staticmethod
1143 def _build_graph():
1144 time.sleep(random.random() * 0.1)
1145 # Do some graph construction. Try to exercise non-trivial paths.
1146 graph = ops.get_default_graph()
1147 gdef = None
1148 for _ in range(10):
1149 x = array_ops.placeholder(dtype=dtypes.float32)
1150 with ops.colocate_with(x):
1151 y = array_ops.placeholder(dtype=dtypes.float32)
1152 with ops.device('/cpu:0'):
1153 z = control_flow_ops.while_loop(
1154 lambda x, y: x < 10, lambda x, y: (x + 1, x * y), [x, y])
1155 with graph._attr_scope({'_a': attr_value_pb2.AttrValue(b=False)}):
1156 gradients_impl.gradients(z, [x, y])
1157 if gdef is None:
1158 gdef = graph.as_graph_def()
1159 else:
1160 importer.import_graph_def(gdef, name='import')
1161
1162 @test_util.run_v1_only('b/120545219')
1163 def testParallelRunAndSingleBuild(self):

Callers 1

Calls 8

colocate_withMethod · 0.80
_attr_scopeMethod · 0.80
as_graph_defMethod · 0.80
rangeFunction · 0.50
sleepMethod · 0.45
placeholderMethod · 0.45
deviceMethod · 0.45
while_loopMethod · 0.45

Tested by

no test coverage detected