问题原因
在macOS通过pip3 install 安装tensorflow(CPU版)后,运行示例代码
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello).decode())
运行之后可以正常输出
“Hello, TensorFlow!”
但是有一个警告警告提示:
I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
在Stack Overflow上面关于这个问题有一个详细的解答
大致翻译一下高赞

在macOS上安装TensorFlow(CPU版)后出现AVX2警告,警告指出CPU支持AVX但未充分利用。该警告源于TensorFlow默认构建时不启用CPU扩展。为充分利用CPU,需要从源码重新安装TensorFlow,启用AVX和FMA扩展。如果拥有GPU,可以直接忽略警告。否则,可以参考GitHub仓库下载对应版本的预编译pip包进行安装。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



