【问题标题】:TensorFlow doesn't seem to installTensorFlow 似乎没有安装
【发布时间】:2018-03-07 17:53:03
【问题描述】:

我有这些警告:

2017-09-26 14:50:45.956966: W tensorflow/core/platform/cpu_feature_guard.cc:45] TensorFlow 库未编译为使用 SSE4.2 指令,但这些在您的计算机上可用并且可以加快 CPU 计算速度。

2017-09-26 14:50:45.956986: W tensorflow/core/platform/cpu_feature_guard.cc:45] TensorFlow 库未编译为使用 AVX 指令,但这些在您的计算机上可用并且可以加快速度CPU 计算。

2017-09-26 14:50:45.956990: W tensorflow/core/platform/cpu_feature_guard.cc:45] TensorFlow 库未编译为使用 AVX2 指令,但这些在您的计算机上可用并且可以加快速度CPU 计算。

2017-09-26 14:50:45.956996: W tensorflow/core/platform/cpu_feature_guard.cc:45] TensorFlow 库未编译为使用 FMA 指令,但这些在您的计算机上可用并且可以加快速度CPU 计算。

所以,根据我在互联网上找到的信息,我点击了这个链接:

https://www.tensorflow.org/install/install_sources

但是,当我尝试时:

$ python

和:

# Python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

输出应该是:Hello, TensorFlow!

但是,我完全不明白......

emixam23@pt-mguittet:~/Workspace$ python
Python 3.6.2 (default, Sep  4 2017, 16:58:35) 
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
2017-09-26 14:56:33.905065: 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.
2017-09-26 14:56:33.905096: 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.
2017-09-26 14:56:33.905105: 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.
2017-09-26 14:56:33.905112: 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.
>>> print(sess.run(hello))
b'Hello, TensorFlow!'
>>> 

即使我安装了它,我仍然有警告,为什么会这样?我用的是Xcode 7.3,没有把GPU放到./configuration进程中。

有什么想法吗? :/ 提前致谢!

【问题讨论】:

    标签: tensorflow installation


    【解决方案1】:

    你为什么说它似乎没有安装?

    你得到了你所期望的(你好,Tensorflow!),但你也得到了这些警告。关于警告,已在此处讨论:Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2

    关于 Hello,Tensorflow! 之前的“b'”,请参阅 What does the 'b' character do in front of a string literal?

    希望对你有帮助。

    【讨论】:

      【解决方案2】:

      您可以像这样屏蔽这些警告:

      import os
      os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
      

      请注意,您的程序仍然输出“Hello,TensorFlow!”,只是在所有有关 SSE4.2 的警告之后。

      【讨论】:

      • 通过这样做,您只会隐藏不回答我的问题的日志,不是吗?感谢您的帮助!
      猜你喜欢
      • 2020-06-12
      • 2011-08-31
      • 1970-01-01
      • 2016-12-26
      • 2011-01-26
      • 2014-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多