2
, 우리는 예를 들면, tf.Session(graph=my_graph)
같은 그래프로 전달할 수TensorFlow 세션 실행 그래프()
import tensorflow as tf
# define graph
my_graph = tf.Graph()
with my_graph.as_default():
a = tf.constant(100., tf.float32, name='a')
# run graph
with tf.Session(graph=my_graph) as sess:
a = sess.graph.get_operation_by_name('a')
print(sess.run(a)) # prints None
을 위의 예에서, 그것은 None
를 출력한다. my_graph
안에 정의 된 연산을 어떻게 실행할 수 있습니까?