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'
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容