AttributeError: module 'tensorflow' has no attribute 'get_variable' AttributeError: module 'tensorflow' has no attribute 'get_variable' python-3.x python-3.x

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


Mentioning the Solution for the benefit of the community.

Downgrading to Tensorflow 1.X Version (1.14 or 1.15) has resolved the issue, as Tensorflow version 2.0 doesn't support get_variable().


tf.Variable does not work for initilizer. Use this instead of tf.compat.v1.get_variable instead of tf.Variable. This works tensorflow 2.0 and above.