def _create_session(self, session_config: Optional[dict]) -> tf.Session:
"""
Create and return TF Session for this model.
By default the session is configured with ``tf.ConfigProto`` created with
the given ``session_config`` as ``**kwargs``. Nested dictionaries such as
``gpu_options`` or ``graph_options`` are handled automatically.
:param session_config: session configuration dict as specified in the config yaml
:return: TensorFlow session
"""
if session_config:
session_config = tf.ConfigProto(**session_config)
return tf.Session(graph=self._graph, config=session_config)
评论列表
文章目录