Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I just tried to enable eager execution in my shell which is actually showing an error:

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

My Tensorflow version is 2.0

The image shows my tensorflow version

can anyone tell me why am I getting this...

Thanks in advance

like image 787
venkatesh Avatar asked Oct 16 '19 05:10

venkatesh


3 Answers

Tensorflow 2.0 has eager_execution enabled by default and so there is no need for you to run tf.enable_eager_execution. Only if your running versions below 2.0 should you enable eager execution

like image 166
stephen_mugisha Avatar answered Nov 03 '22 06:11

stephen_mugisha


Eager execution is enabled by default in version 2.x You can check that by using

tf.executing_eagerly()

It should return True. If you are having version less then 2.0 then it can be enabled by using

tf.enable_eager_execution()
like image 6
asharma Avatar answered Nov 03 '22 08:11

asharma


for tensorflow v1.x code, this will works:

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
tf.enable_eager_execution()
like image 2
sailfish009 Avatar answered Nov 03 '22 07:11

sailfish009