I import tensorflow (version 1.13.1) and need ConfigProto
:
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})
I get this error:
AttributeError: module 'tensorflow' has no attribute 'ConfigProto'
How do I resolve this?
ConfigProto disappeared in tf 2.0, so an elegant solution is:
import tensorflow as tf
and then replace:
tf.ConfigProto
by tf.compat.v1.ConfigProto
In fact, the compatibility built in 2.0 to get tf 1.XX: tf.compat.v1
is really helpful.
Useful link: Migrate your tensorflow 1. code to tensorflow 2.: https://www.tensorflow.org/guide/migrate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With