a = tf.compat.v1.constant(5.0)
b = tf.compat.v1.constant(6.0)
sum1 = a + b
g = tf.compat.v1.Graph()
with g.as_default():
# Define operations and tensors in `g`.
hello = tf.compat.v1.constant('hello')
assert hello.graph is g
sess = tf.compat.v1.Session(graph=g)
print(sess.run(sum1))
Run Code Online (Sandbox Code Playgroud)
tensorflow-gpu2.0 我不知道为什么。我是张量流的初学者
小智 5
导入tensorflow后需要禁用急切执行,如下所示:
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
Run Code Online (Sandbox Code Playgroud)
这对我有用。
| 归档时间: |
|
| 查看次数: |
8002 次 |
| 最近记录: |