. Advertisement .
..3..
. Advertisement .
..4..
I am new to python and searching the “attributeerror module tensorflow has no attribute configproto” to understand it better. It seems it doesn’t work as expected when I used some suggestions before. Here is the command line I use:
import tensorflow as tf
config = tf.ConfigProto(intra_op_parallelism_threads=8,
inter_op_parallelism_threads=8,
allow_soft_placement=True,device_count = {'CPU' : 1, 'GPU' : 1})
The error I’m getting is below:
AttributeError: module 'tensorflow' has no attribute 'ConfigProto'
Please give me the solution to this issue.
The cause:
You are attempting to access an attribute (method or property) for an object that does not exist. The line “‘module ‘tensorflow’ has no attribute ‘ConfigProto'” indicates that the ConfigProto attribute is missing from the tensorflow module (). Therefore, the error happens.
Solution:
You can resolve your problem just by adding 2 lines in the main.py file w/ Tensorflow code:
ConfigProto vanished in tf 2.0. Here’s an elegant solution:
Then, replace:
tf.ConfigProto
bytf.compat.v1.ConfigProto
Actually, the compatibility built into 2.0 to get tf1.XX:
tf.compat.v1
really helps.Useful link: Migrate your tensorflow 1. code to tensorflow 2.: https://www.tensorflow.org/guide/migrate