hello tensorflow,我的第一个tensorflow程序

python学习网 2019-11-28 23:15:03

上代码:

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 

 

 若对您有用,请赞助个棒棒糖~

 

阅读(2494) 评论(0)