-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError: The Session graph is empty. Add operations to the graph before calling run() #400
Comments
This above code is taken from Tensorflow Core r2.0 Document RuntimeError: The Session graph is empty. Add operations to the graph before calling run()The thing is
This gives the output without any errors |
Running the tensor flow session after disabling eager_execution as stated above still finding the same bug. |
@Krishnarohith10 The resolution helped me. |
Here's my implementation of the above issue. I have had it done using Kaggle Notebook. It is working. If not, can you post your code? |
@Krishnarohith10 |
Okay. Did you try first method? Using tf.compact.v1.disable_eager_execution(), you can now use tf.session() with .run(). Which I hope it works and hope you are familiar with. |
Hi @Krishnarohith10 , I tried following your approach, but still having the issue. Please suggest on how to fix this. Here is my code hello_constant = tf.constant('Hello World!') tf.compat.v1.disable_eager_execution() |
@Krishnarohith10 .. it works. Thank you so much |
it worked for me too |
worked out perfectly |
@HARIKABANDARU and also to everyone, Ignore those messages those are because of the version of tensorflow, since we're using old version and also there been a lot changes to that version. Now Unlike tensorflow=1.x, tensorflow=2.x has tf.executing_eagerly()-->True which means we no need to use tf.Session(), tf.Session() is only meant for if tf.executing_eagerly()-->False, which in case of tensorflow=1.x, but as tensorflow=2.x is True for tf.executing_eagerly(), we don't need to use it. We can surely omit that statement and can do your coding or projects. Have a look: and if we want the result or value of your output variable we can access it by using .numpy() Here it is! That's all I wanted to say, and everyone please update your working libraries like tensorflow or anyother librabries to the latest version so that we don't wanna stay behind the world, do we? And I myself with the latest versions of machine-learning and deep-learning libraries working on few projects, because I wanted to work or get a job in this A.I domain. This is a little background of me to you. I been dealing with this libraries pretty much years till now, still even I got few issues which can't solve but anyways. If any queries please don't hesitate to ask regarding tensorflow, please! And @HARIKABANDARU Please try just doing this with your project or If you give me data or If it available online then I can tell test it myself and tell you the results if not you can try your own. |
@Krishnarohith10 thank you for sharing it was very useful! |
I also had the same problem, but the difference is that I was using the "1.15" version of tensorflow. Suddenly, I knew the reason why I had this problem. Because I added this sentence |
If you don't have any GPU on your PC, then you need to install non-gpu version of tensorflow. You can find it on official tensorflow.org website. |
It works! Thanks for sharing. |
ThX |
keras==2.3.1 and tensorflow==2.0.0
can somebody help me ?
Please !
The text was updated successfully, but these errors were encountered: