TensorFlow学习中的第一个坑

安装TensorFlow好了,运行下面的代码

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

你会遇到这样的提示

[Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2]

stackoverflow网站有比较好的答案
https://stackoverflow.com/questions/47068709/your-cpu-supports-instructions-that-this-tensorflow-binary-was-not-compiled-to-u

最简单办法就是忽略它,在代码的顶端加入下面的代码

# Just disables the warning, doesn't enable AVX/FMA
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

你可能感兴趣的:(TensorFlow学习中的第一个坑)