我曾尝试根据其官方网站上的指南从源代码安装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。
谢谢!
答案 0 :(得分:5)
如果不从源代码构建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
个日志静音。