introduction h1>
tensorflow2.x has been greatly changed over 1.x to make TensorFlow users more efficient. Where Tf.contrib was abandoned altogether is a major change of 2.x version, but import tensorflow.contrib.slim as Slim as a superior package, has been widely used in many previous versions. Most of the source code is still written based on the TensorFlow1.x version, which makes some modules that have been removed from the 2.x version unusable.
main problem
when running a import tensorflow. Contrib. Slim as slim code>
p>
: ModuleNotFoundError: No module named 'tensorflow. Contrib KBD> false
p>
solution
query existing solutions, most of the use of the reduced version of the method, if you want to use this method can go to the query.
because I don't want to use the method of reducing the version to solve, after searching on github to find out the information
link: tf.contrib.slim is not worked in tensorflow 2.0 what is the alternative for that?.
Tf - slim has a independent of tensorflow mirror to tf.com pat. V1 compatible mode is used, install the package can be p>
tf-slim is a lightweight library for defining, training, and evaluating complex models in TensorFlow. Tf-slim's components can be freely blended with the native TensorFlow and other frameworks.
here you can find information about Slim: link.
h2> operation
use PIP to download tf-slim
in CMD
pip install --upgrade tf_slim
download:
p>
note when using Slim library:
#import tensorflow.contrib.slim as slim
import tf_slim as slim
where the commented out part is the source code, modified no longer report an error.
(ps: the ability is limited, if there is an error, please point out.
Read More:
- Problem solving module ‘ tensorflow.compat . V2 ‘has no attribute’ contrib ‘and importerror cannot import name’ auto ‘
- Record a problem of no module named ‘tensorflow. Examples’ and’ tensorflow. Examples. Tutorials’ in tensorflow 2.0
- tf.contrib.layers .xavier_ Initializer function usage
- Tensorflow operation report error modulenotfounderror: no module named ‘tensorflow. Python. Types’ solution
- About the problem of calling tools library by running Python program under Mac OS X, modulenotfoundererror: no module named ‘tools‘
- Cannot find module ‘vs/editor/contrib/inlineHints/inlineHintsController‘
- ModuleNotFoundError: No module named ‘tensorflow_core.estimator‘
- To solve the problem of importerror when installing tensorflow: libcublas.so . 10.0, failed to load the native tensorflow runtime error
- Module not found error: the solution to the problem of no module named ‘MySQL’
- Modulenotfounderror: no module named ‘CV2’ – (version problem)
- How to solve the problem of error reporting in the introduction of Python Django no module name ‘Django. Utils. Six’
- Solve the problem that “figure size 640×480 with 1 axes” does not display pictures in jupyter notebook
- Tensorflow error: module ‘tensorflow’ has no attribute ‘xxx’
- [opencv + openvino] opencv-vino4.5.1 + opencv contrib installation
- Tensorflow reported an error when using session module: attributeerror: module ‘tensorflow’ has no attribute ‘session’, which has been solved
- Record pyinnstaller package file execution error modulenotfoundererror: no module named ‘cmath’ solution
- No module named numpy error in Python code
- Solve the problem that target code version of Maven project sub module in IntelliJ idea is always rolled back
- Solve the problem of red wavy line in pychar when importing module written by oneself
- A problem occurred configuring project ‘:x x x‘. > java.lang.NullPointerException (no error message)