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

module 'tensorflow' has no attribute 'global_variables_initializer'. it is an AttributeError.

💻problem


#init_op = tf.initialize_all_variables()
init_op =  tf.global_variables_initializer()

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-13-9cab3748941a> in <module>()
     12 
     13 #init_op = tf.initialize_all_variables()
---> 14 init_op =  tf.global_variables_initializer()
     15 
     16 sess = tf.Session()

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


💻Changes should be made



#init_op = tf.initialize_all_variables()
init = tf.compat.v1.global_variables_initializer()

Comments

Popular posts from this blog

Sri Lankan IT industry & companies

Find Odd & Even number - pseudocode