本文的操作是在你已经安装和配置好tensorflow(简称tf)的情况下,详细的操作步骤如下:
第一步:首先准备好带测试的代码
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))
第二步:在VS code下载插件jupyter
第三步:设置编译环境为tensorflow
最后一步:执行待测试的源码
测试成功。