Skip to main content

Simple python package to shut up Tensorflow warnings and logs.

Project description

Travis CI build SonarCloud Quality SonarCloud Maintainability Codacy Maintainability Maintainability Pypi project Pypi total project downloads

Simple python package to shut up Tensorflow warnings and logs.

How do I install this package?

As usual, just download it using pip:

pip install silence_tensorflow

Tests Coverage

Since some software handling coverages sometime get slightly different results, here’s three of them:

Coveralls Coverage SonarCloud Coverage Code Climate Coverate

How do I use it?

You only need to import the package before import Tensorflow:

import silence_tensorflow
import tensorflow as tf

...

# your code

How does this work under the hood?

This package will set the KMP_AFFINITY system variable to “noverbose”, TF_CPP_MIN_LOG_LEVEL to level 2 (only errors logged) and silence both FutureWarning and DeprecationWarning.

If you need a custom value for KMP_AFFINITY you should reset it after importing the package, as follows:

import os
backup = os.environ["KMP_AFFINITY"]
import silence_tensorflow
os.environ["KMP_AFFINITY"] = backup

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

silence_tensorflow-1.0.2.tar.gz (3.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page