上代码:
import tensorflow as tf if __name__=='__main__': g = tf.Graph() # add ops to the user created graph with g.as_default(): hello = tf.constant('Hello Tensorflow') sess = tf.compat.v1.Session(graph=g) print(sess.run(hello))
输出如下图右侧:
说明:python3.7.4 ,tensorflow2.0
若对您有用,请赞助个棒棒糖~