Creates a new TensorFlow session. If no `graph` argument is specified when constructing the session, the default graph will be launched in the session. If you are using more than one graph (created with `tf.Graph()`) in the same process, you will have to use different sessions for e
(self, target='', graph=None, config=None)
| 1571 | """ |
| 1572 | |
| 1573 | def __init__(self, target='', graph=None, config=None): |
| 1574 | """Creates a new TensorFlow session. |
| 1575 | |
| 1576 | If no `graph` argument is specified when constructing the session, |
| 1577 | the default graph will be launched in the session. If you are |
| 1578 | using more than one graph (created with `tf.Graph()`) in the same |
| 1579 | process, you will have to use different sessions for each graph, |
| 1580 | but each graph can be used in multiple sessions. In this case, it |
| 1581 | is often clearer to pass the graph to be launched explicitly to |
| 1582 | the session constructor. |
| 1583 | |
| 1584 | Args: |
| 1585 | target: (Optional.) The execution engine to connect to. Defaults to using |
| 1586 | an in-process engine. See |
| 1587 | [Distributed TensorFlow](https://tensorflow.org/deploy/distributed) for |
| 1588 | more examples. |
| 1589 | graph: (Optional.) The `Graph` to be launched (described above). |
| 1590 | config: (Optional.) A |
| 1591 | [`ConfigProto`](https://www.tensorflow.org/code/tensorflow/core/protobuf/config.proto) |
| 1592 | protocol buffer with configuration options for the session. |
| 1593 | """ |
| 1594 | super(Session, self).__init__(target, graph, config=config) |
| 1595 | # NOTE(mrry): Create these on first `__enter__` to avoid a reference cycle. |
| 1596 | self._default_graph_context_manager = None |
| 1597 | self._default_session_context_manager = None |
| 1598 | |
| 1599 | def __enter__(self): |
| 1600 | if self._default_graph_context_manager is None: |