Difference between ClientSession and Session in TensorFlow C ++ API

TensorFlow r1.0 C ++ API comes with the Session and ClientSession . Some of the examples provided with TensorFlow use ClientSession , while others use Session . Do these two different types of sessions use the same basic mechanism under the hood or one of the preferred ones over the other? The syntax for using them is slightly different, but are there any other differences in behavior?

+5
source share
1 answer

In the TensorFlow C ++ API, the tensorflow::Session API is a low-level interface that deals with the serialized GraphDef protocol GraphDef and provides a line-based interface for running subgraphs.

Unlike tensorflow::ClientSession API is a higher level and integrates with the new C ++ API for building TensorFlow charts - much in the same way as the Python tf.Graph and tf.Session classes do.

Therefore, you probably want to use tensorflow::ClientSession if you are building a graph using the C ++ API, but tensorflow::Session easier to use if you already have a serialized GraphDef (representing, for example, a pre -trained model ) and just want to make a conclusion to this model.

+7
source

Source: https://habr.com/ru/post/1265048/


All Articles