TF : Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2

背景

在学习第一个TensorFlow程序的时,遇到的问题。

  • 环境:macos
  • 执行命令 python hello_tensorflow.py

问题

程序
import tensorflow as tf

hello = tf.constant('Hello, TensorFlow!')
meaning = tf.constant('The Answer to Life, the Universe and Everything is ')

sess    = tf.Session()
msg_op  = sess.run(hello)
mean_op = sess.run(meaning)
print(msg_op)
print(mean_op)

a       = tf.constant(10)
b       = tf.constant(32)
cal_op  = sess.run(a + b)
print(cal_op)

sess.close()
结果
2019-03-20 15:59:32.816956: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Hello, TensorFlow!
The Answer to Life, the Universe and Everything is
42

参考

https://stackoverflow.com/questions/47068709/your-cpu-supports-instructions-that-this-tensorflow-binary-was-not-compiled-to-u

修改后

import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

hello = tf.constant('Hello, TensorFlow!')
meaning = tf.constant('The Answer to Life, the Universe and Everything is ')

sess    = tf.Session()
msg_op  = sess.run(hello)
mean_op = sess.run(meaning)
print(msg_op)
print(mean_op)

a       = tf.constant(10)
b       = tf.constant(32)
cal_op  = sess.run(a + b)
print(cal_op)

sess.close()

你可能感兴趣的:(TF : Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2)