Home > other >  AttributeError: module 'tensorflow' has no attribute 'global_variables_initializ
AttributeError: module 'tensorflow' has no attribute 'global_variables_initializ

Time:10-12

 import tensorflow as tf 
A=3
# the create a variable
W=tf. Variable ([[0.5, 1.0]])
X=tf. Variable ([[2.0], [1.0]])
Y=tf. Matmul (w, x)
Print (y)
# the variables have to be expicitly initialized before you can run the ops

With tf. The Session () as sess:
Sess. Run (tf) global_variables_initializer ())
Print (y)

Run times wrong, there is no global variable parameters, it is because tensorflow2.0 version will be 1 x version packaging to compat. Everything in v1,
Will import tensorflow as tf to import tensorflow.com pat. V1 as tf, problem solving,

CodePudding user response:

Yes, tf2 and tf1 completely different, version management,
  • Related