import tensorflow as tf
#定义两个向量a,b
a = tf.constant([1.0, 2.0], name='a')
b = tf.constant([2.0, 3.0], name='b')
result = a+b
sess = tf.Session() #生成一个会话,通过一个会话session来计算结果
#实现了一个简单的Tensorflow模型
print(sess.run(result))
>>[ 3. 5.]
若出现计算结果,则安装成功。
2018-01-02 16:33:21.854009: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2018-01-02 16:33:21.854024: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2018-01-02 16:33:21.854028: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2018-01-02 16:33:21.854032: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
若出现这些标红的代码,可暂时忽略不计,不影响TensorFlow运行计算。