tf2.py 177 B

1234567891011
  1. #%%
  2. import tensorflow as tf
  3. assert tf.__version__.startswith('2.')
  4. # 1.创建输入张量
  5. a = tf.constant(2.)
  6. b = tf.constant(4.)
  7. # 2.直接计算并打印
  8. print('a+b=',a+b)