运行环境
Spyder4.0+Python3.7
来源
https://github.com/dragen1860/Deep-Learning-with-TensorFlow-book。
代码
import tensorflow as tf
assert tf.__version__.startswith('2.')
# 1.创建输入张量
a = tf.constant(2.)
b = tf.constant(4.)
# 2.直接计算并打印
print('a+b=',a+b)
Spyder4.0+Python3.7
https://github.com/dragen1860/Deep-Learning-with-TensorFlow-book。
import tensorflow as tf
assert tf.__version__.startswith('2.')
# 1.创建输入张量
a = tf.constant(2.)
b = tf.constant(4.)
# 2.直接计算并打印
print('a+b=',a+b)