Add experimental Session::MakeCallable() API and implement it for DirectSession.
authorDerek Murray <mrry@google.com>
Sat, 10 Mar 2018 02:12:02 +0000 (18:12 -0800)
committerTensorFlower Gardener <gardener@tensorflow.org>
Sat, 10 Mar 2018 02:16:14 +0000 (18:16 -0800)
commit2426308fa58ebf473092918cc8ffa215325c4079
tree970b621f2d4296f02a0eb855627022a5a807284d
parent05aa4e58c88d037868b24a1557a58bc8dd357106
Add experimental Session::MakeCallable() API and implement it for DirectSession.

The intent of this new API matches the Python `tf.Session.make_callable()`
method: it splits the two roles of the `Session::Run()` method into separate
methods:

1. `Session::MakeCallable()` takes information about a subgraph (such as the
   names of nodes to feed and fetch), and prunes and optimizes that graph,
   returning a simple handle.
2. `Session::RunCallable()` takes that handle, plus any values to be fed,
   and executes the graph, returning whatever outputs are produced.

This split moves string processing off the critical path of running a
step. We also add a new method `Session::ReleaseCallable()` that makes
it possible to free the resources associated with a cached subgraph,
and could be useful for seldom-executed graphs such as initializers.

PiperOrigin-RevId: 188566635
tensorflow/core/common_runtime/direct_session.cc
tensorflow/core/common_runtime/direct_session.h
tensorflow/core/common_runtime/direct_session_test.cc
tensorflow/core/framework/session_state.h
tensorflow/core/protobuf/config.proto
tensorflow/core/public/session.h