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

Function main

tensorflow/contrib/graph_editor/examples/edit_graph_example.py:30–50  ·  view source on GitHub ↗
(_)

Source from the content-addressed store, hash-verified

28
29
30def main(_):
31 # create a graph
32 g = tf.Graph()
33 with g.as_default():
34 a = tf.constant(1.0, shape=[2, 3], name="a")
35 b = tf.constant(2.0, shape=[2, 3], name="b")
36 c = tf.add(
37 tf.placeholder(dtype=np.float32),
38 tf.placeholder(dtype=np.float32),
39 name="c")
40
41 # modify the graph
42 ge.swap_inputs(c.op, [a, b])
43
44 # print the graph def
45 print(g.as_graph_def())
46
47 # and print the value of c
48 with tf.Session(graph=g) as sess:
49 res = sess.run(c)
50 print(res)
51
52
53if __name__ == "__main__":

Callers

nothing calls this directly

Calls 8

as_defaultMethod · 0.95
as_graph_defMethod · 0.95
GraphMethod · 0.45
constantMethod · 0.45
addMethod · 0.45
placeholderMethod · 0.45
SessionMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected