How do I resolve these tensorflow warnings?

后端 未结 7 823
北恋
北恋 2020-12-31 06:36

I just installed Tensorflow 1.0.0 using pip. When running, I get warnings like the one shown below.

W tensorflow/core/platform/cpu_feature_guard.cc:45] The Ten

相关标签:
7条回答
  • 2020-12-31 07:09

    As the warnings say you should only compile TF with these flags if you need to make TF faster.

    You can use TF environment variable TF_CPP_MIN_LOG_LEVEL and it works as follows:

    • It defaults to 0, displaying all logs
    • To filter out INFO logs set it to 1
    • WARNINGS additionally, 2
    • and to additionally filter out ERROR logs set it to 3

    So you can do the following to silence the warnings:

    import os
    os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
    import tensorflow as tf
    
    0 讨论(0)
  • 2020-12-31 07:20

    I don't know much about C, but I found this

    bazel build --linkopt='-lrt' -c opt --copt=-mavx --copt=-msse4.2 --copt=-msse4.1 --copt=-msse3-k //tensorflow/tools/pip_package:build_pip_package
    

    How you build you program?

    0 讨论(0)
  • 2020-12-31 07:21

    My proposed way to solve the problem:

    #!/usr/bin/env python3
    import os
    import tensorflow as tf
    os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
    

    Should work at least on any Debian or Ubuntu systems.

    0 讨论(0)
  • 2020-12-31 07:21

    It seems that even if you don't have a compatible (i.e. Nvidia) GPU, you can actually still install the precompiled package for tensorflow-gpu via pip install tensorflow-gpu. It looks like in addition to the GPU support it also supports (or at least doesn't complain about) the CPU instruction set extensions like SSE3, AVX, etc. The only downside I've observed is that the Python wheel is a fair bit larger: 90MB for tensorflow-gpu instead of 42MB for plain tensorflow.

    On my machine without an Nvidia GPU I've confirmed that tensorflow-gpu 1.0 runs fine without displaying the cpu_feature_guard warnings.

    0 讨论(0)
  • 2020-12-31 07:28

    It would seem that the PIP build for the GPU is bad as well as I get the warnings with the GPU version and the GPU installed...

    0 讨论(0)
  • 2020-12-31 07:29

    Those are simply warnings. They are just informing you if you build TensorFlow from source it can be faster on your machine.

    Those instructions are not enabled by default on the builds available I think to be compatible with more CPUs as possible.

    0 讨论(0)
提交回复
热议问题