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

前端 未结 5 1826
庸人自扰
庸人自扰 2021-01-01 10:16

I\'m working in Pytorch. I can import tensorflow (version 1.13.1) and need ConfigProto:

import tensorflow as tf
config = tf.ConfigProto(intra_op_parallelism         


        
5条回答
  •  粉色の甜心
    2021-01-01 10:35

    I had similar issues, when upgraded to Python 3.7 & Tensorflow 2.0.0 (from Tensorflow 1.2.0)

    This is an easy one and works!

    If you don't want to touch your code, just add these 2 lines in the main.py file w/ Tensorflow code:

    import tensorflow.compat.v1 as tf
    tf.disable_v2_behavior()
    

    And that's it!!
    NOW Everything should run seamlessly :)

提交回复
热议问题