tensorflow - 如何在不从源安装tensorflow的情况下使用SSE4.1指令?

标签 tensorflow

我尝试过按照官方网站上的指南从源代码安装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/

相关文章:

python - 如何确保我的 Keras/tensorflow 代码使用我的 MacBook Pro 的 AMD 显卡

tensorflow - 将现有模型以前动态的占位符尺寸设为静态

machine-learning - 多个独立标签的成本和激活函数

tensorflow - 使用 Keras 进行多维回归

python - 无法理解 keras.layers.Embedding() 的含义

c++ - Tensorflow CUDA Reduction Op 没有完全减少

python - 第二次运行tensorflow时出错

导入 tensorflow 1.7 时 Python 内核死机

tensorflow - LSTM 单元的单元数和内存 "distance"之间有关系吗?

c++ - tensorflow 和 tflearn C++ API