我尝试过按照官方网站上的指南从源代码安装Tensorflow,但体验非常不愉快。
我可以看到的无法从源安装的直接结果如下:
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.
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.
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.
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.
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.
我想知道是否有一种方法可以“使用 SSE4.1 指令”和上面提到的其他指令,而无需从源代码安装 Tensorflow。
谢谢!
最佳答案
如果不从源代码构建 TensorFlow,则无法使用 SIMD 指令。
默认情况下,TensorFlow 二进制文件没有进行此优化,以尽可能提高与更广泛的 CPU 架构的兼容性。
如果您想消除警告,可以将 TF_CPP_MIN_LOG_LEVEL
设置为 2,如下所示:
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf
此 TF 环境变量默认为 0
,显示所有日志。
将其设置为 1
将过滤掉 INFO
日志,2
将另外静默 WARNING
日志。
关于tensorflow - 如何在不从源安装tensorflow的情况下使用SSE4.1指令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43335531/