Reputation: 2118
My last project with tensorflow was in 2016, since then Eager Execution was introduced. After reading further into it, it seems as if it can be used instead of the original approach with a session object.
Since Eager Execution gives better feedback and a more straight forward approach to designing and debugging neural networks, should we always use Eager Execution for new projects, or are there advantages of the original session approach?
Upvotes: 4
Views: 2296
Reputation: 59701
EDIT:
The answer below is based on the announcement post of Eager move and the current available documentation. However l, rachelim's answer gives further insight about future plans for Eager mode and its more important role in TensorFlow 2.x.
No, eager execution was introduced as a "simple mode" for learning and experimentation. The strength of TensorFlow is in its computation graph structure and its independence from the execution environment (session); this is what allows you to run the same model distributed on different machines or export it to use across different languages, for example.
Of course, you can very much use eager mode in "production", if that fulfils all your needs, but note that you will not have access to many advanced features, and, even in the cases where these can be "ported" to eager execution, doing so may not be a priority for the developers, since it is not supposed to supersede the "traditional" execution mode.
EDIT: For further reference, see Work with graphs in the Eager Execution guide, which points out some of the benefits of graph-based vs eager code and how you would go about working with both.
Upvotes: 1
Reputation: 480
In tensorflow 2.0, eager execution will be enabled by default. It is intended to be able to completely replace graph/session mode, and is a priority for tensorflow developers. For more details, and to join in the discussion on the topic, check out the this RFC on the tensorflow github: RFC: Functions, not sessions in 2.0. The tensorflow roadmap also alludes to this.
Using eager mode for new projects is fine. As of now, there are still advantages to the original session approach (as jdehesa mentioned, some "advanced features" are not eager-compatible yet), but tensorflow developers are actively working on improving eager (and graph) mode. If you encounter any issues or missing features, we appreciate bug reports on github.
Upvotes: 4