(_)
| 28 | |
| 29 | |
| 30 | def 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 | |
| 53 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected