Error trying to use tensorflow in Google Collection: AttributeError: module 'tensorflow' has no attribute 'ConfigProto'

Asked 2 years ago, Updated 2 years ago, 80 views

First of all, the following error が came out.

ModuleNotFoundError: No module named 'tensorflow.compat.v2'

I got an error, so I tried the following.

!pip install tensorflow-gpu==2.1.0

When I tried, the error of の disappeared, but now I get the error が below.

AttributeError: module 'tensorflow' has no attribute 'ConfigProto'

Please tell me how to solve this problem.
I have no knowledge of programming.
Thank you for your cooperation.

tensorflow google-colaboratory

2022-09-29 20:28

1 Answers

I had a similar question.
https://stackoverflow.com/questions/56127592/attributeerror-module-tensorflow-has-no-attribute-configproto

ConfigProto appears to be obsolete in version 2.0 and later.
Try replacing tf.ConfigProto with tf.compat.v1.ConfigProto

[Additional note]
This is an example of a change.Isn't the code as follows?

import tensorflow as tf

~~~

## Error
conf=tf.ConfigProto(...)

## OK.
conf=tf.compat.v1.ConfigProto(...)


2022-09-29 20:28

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.