Neargye / hello_tf_c_api

Neural Network TensorFlow C API
MIT License
468 stars 134 forks source link

what's the relation between c++ client session and c_api TF_Session and core/public/session in tensorflow source code? #29

Closed duocang closed 5 years ago

duocang commented 5 years ago

This is a question mentioned in stackoverflow.

I am also confused, when people use Session* session, while TF_session* session is used here.

The question comes to here: why do we need a tensorflow.dll

what's the relation between c++ client session and c_api TF_Session and core/public/session in
tensorflow source code? I'm reading the source code of tensorflow, but I'm confused to found
that there are many parts about session,

1. tensorflow/c/c_api_internal.cc defined TF_Session
2. tensorflow/c/c_api_test.cc defined a class CSession
3. tensorflow/cc/client/client_session.cc
4. tensorflow/core/public/session.h

then what's exactly a 'session'?Where's the concrete 'run' function of session?
Neargye commented 5 years ago

Hi, I do not quite understand the question.

  1. why do we need a tensorflow.dll - tensorflow.dll way to use C API without the need to build TF, as well as have a single cross-platform interface. I also do not urge to use C API, if you prefer to use any other API, better use it. For internal reasons at work, it was convenient to use the С API, later I made this repository purely, for example, maybe it turned out to be useful to someone.

  2. what's the relation between c++ client session and c_api TF_Session and core/public/session in tensorflow source code - It is well described in the answer https://stackoverflow.com/a/44714132/9514814. Again, in this repository, examples of the code that we use at work, other wrappings and implementations are possible.

Neargye commented 5 years ago

Do you have any additional questions?

duocang commented 5 years ago

@Neargye I am searing more information, but I can shutdown this for now.