diff options
author | Skye Wanderman-Milne <skyewm@google.com> | 2018-03-06 17:19:36 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-03-06 17:23:35 -0800 |
commit | 9c3cf322a3051339899ffb74c33533f60c0c2d8e (patch) | |
tree | be3c72e843a9178be50c0e5a791686d1253cea82 /tensorflow/c/python_api.cc | |
parent | 6e99d56489b4e6c3176fa1199d4270b6439a22fe (diff) |
Make graph construction work while graph is being concurrently run.
The overall approach is to use Graph._lock to synchronize Session.run calls and construction methods that rely on graph mutation. We don't want to synchronize the actual running of the graph, only the Extend call, so this change exposes an ExtendSession method to the Python API and disables extending automatically in TF_SessionRun.
PiperOrigin-RevId: 188106818
Diffstat (limited to 'tensorflow/c/python_api.cc')
-rw-r--r-- | tensorflow/c/python_api.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tensorflow/c/python_api.cc b/tensorflow/c/python_api.cc index f553142d15..26683f50ec 100644 --- a/tensorflow/c/python_api.cc +++ b/tensorflow/c/python_api.cc @@ -104,4 +104,10 @@ void SetRequireShapeInferenceFns(TF_Graph* graph, bool require) { graph->refiner.set_require_shape_inference_fns(require); } +void ExtendSession(TF_Session* session, TF_Status* status) { + mutex_lock l(session->mu); + session->extend_before_run = false; + ExtendSessionGraphHelper(session, status); +} + } // namespace tensorflow |