import tensorflow as tf
a = tf.constant([1.0, 2.0], name=”a”)
b = tf.constant([2.0, 3.0], name=”b”)
result = a + b
sess = tf.Session()
print(sess.run(result))
执行结果如下
2018-05-08 21:35:22.221312: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn’t compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2018-05-08 21:35:22.221351: 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-05-08 21:35:22.221378: 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-05-08 21:35:22.221406: 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-05-08 21:35:22.221413: 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.
[ 3. 5.]
Process finished with exit code 0
修改之后
import os
os.environ[‘TF_CPP_MIN_LOG_LEVEL’]=’2’
import tensorflow as tf
a = tf.constant([1.0, 2.0], name=”a”)
b = tf.constant([2.0, 3.0], name=”b”)
result = a + b
sess = tf.Session()
print(sess.run(result))
执行结果如下
[ 3. 5.]
Process finished with exit code 0