Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I resolve these tensorflow warnings?

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 TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.

I get 5 more similar warning for SSE4.1, SSE4.2, AVX, AVX2, FMA.

Despite these warnings the program seems to run fine.

like image 396
Abhai Kollara Avatar asked Feb 16 '17 10:02

Abhai Kollara


People also ask

How do I get rid of TensorFlow warnings?

So to knock out these warnings in a single blow, do import warnings then warnings. filterwarnings('ignore') , then run your tensorflow imports and and code that relies on the broken alpha-tensorflow code, then turn warnings back on via warnings. resetwarnings() .

Does Python 3.7 supports TensorFlow?

TensorFlow is tested and supported on the following 64-bit systems: Python 3.7–3.10. Ubuntu 16.04 or later.


4 Answers

export TF_CPP_MIN_LOG_LEVEL=2 solved the problem for me on Ubuntu.

https://github.com/tensorflow/tensorflow/issues/7778

like image 158
Ajay Singh Avatar answered Oct 24 '22 07:10

Ajay Singh


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.

like image 30
jcamdr Avatar answered Oct 24 '22 07:10

jcamdr


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?

like image 2
Christian Frei Avatar answered Oct 24 '22 06:10

Christian Frei


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.

like image 1
Neil Halelamien Avatar answered Oct 24 '22 08:10

Neil Halelamien