Also with TF 2.x you could organize your code around functions instead of handling TF 1 sessions:

  

      github.com
  

  
    tensorflow/community/blob/master/rfcs/20180918-functions-not-sessions-20.md 1


    # TensorFlow 2.0: Functions, not Sessions.

| Status        | Accepted                                             |
:-------------- |:---------------------------------------------------- |
| **Author(s)** | ashankar@google.com, joshl@google.com                |
| **Sponsor**   | apassos@google.com                                   |
| **Updated**   | 2018-10-02                                           |

## Objective

This document presents a proposal to make TensorFlow be more "Pythonic" in 2.0. In five bullet points, the proposal is to:

*   Encourage the encapsulation of graph computation as Python functions \
(where the graph is executed when the function is invoked, instead of via `Session`)
*   Align "state" in the TensorFlow runtime (e.g., resource tensors like those that back `tf.Variable` objects) with state in the Python program (e.g., Python objects corresponding to the runtime state with lifetimes attached to each other).
*   Make it easy to export these encapsulations to a `GraphDef`+Checkpoint and/or `SavedModel`.
*   Enable eager execution by default.
*   Provide a path for incorporating existing code that uses the 1.x APIs to construct TensorFlows graphs as functions in TensorFlow 2.x programs.

This document liberally employs the use of sample code to describe the end-user effect of proposed changes.



  This file has been truncated. show original