注意 :这些不是错误消息,而仅仅是警告消息。
最大化TF性能的最佳方法(除了编写出色的代码!!),还可以从源代码进行编译。
当您这样做时,TF会要求您提供多种选择,其中还包括这些说明的选择。
以我自己的经验,从源头进行编译的平均性能更好。
如果您正在做一些可以在GPU上完成的密集处理,那么这也可能解释您的等待时间。为了支持GPU,您需要执行pip3 install tensorflow-gpu
0
注意 :这些不是错误消息,而仅仅是警告消息。
最大化TF性能的最佳方法(除了编写出色的代码!!),还可以从源代码进行编译。
当您这样做时,TF会要求您提供多种选择,其中还包括这些说明的选择。
以我自己的经验,从源头进行编译的平均性能更好。
如果您正在做一些可以在GPU上完成的密集处理,那么这也可能解释您的等待时间。为了支持GPU,您需要执行pip3 install tensorflow-gpu
0
您还可以使用带有opt参数的bazel进行编译:
bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-msse4.1 --copt=-msse4.2 //tensorflow/tools/pip_package:build_pip_package
我认为您可以在此讨论中找到一些东西: 如何使用SSE4.2和AVX指令编译Tensorflow?
祝好运!
0
这些是警告,表示从源头在您的PC上构建Tensorflow可能会更快。
但是,如果要禁用它们,则可以使用以下代码
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf
这应该使警告消失。 'TF_CPP_MIN_LOG_LEVEL'代表负责日志记录的Tensorflow环境变量。另外,如果您使用的是Ubuntu,则可以在下面使用此代码
export TF_CPP_MIN_LOG_LEVEL=2
我希望这有帮助。
0
MacBook Air:OSX El Capitan
当我在终端(
python 3 tfpractice.py
)中运行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.
我不知道如何解决这个问题。我想让TensorFlow可以在此pip3安装上正常工作。所以我遵循了以下路径:
tensorflow/core/platform/cpu_feature_guard
我需要在这里编辑代码吗?还是有其他方法让TensorFlow与这些指令一起编译?
我使用
sudo pip3 install tensorflow
安装了TensorFlow。