Background
I'm learning TensorFlow by walking through part II of Hands-On Machine Learning with Scikit-Learn and TensorFlow, and one of the exercise questions is (bolded text my own addition to add clarity to question):
"If you create a graph g
containing a variable w
, then start two threads and open a session in each thread, both using the same graph g
, will each session have its own copy of the variable w
or will it be shared?"
The answer provided in the back of the book is below:
"In local TensorFlow, session manage variable values, so if you create a graph g
containing variable w
, then start two threads and open a local session in each thread, both using the same graph g
, then each session will have its own copy of the variable w
..."
My Question
Is A) or B) the correct interpretation of what is happening?
A). Both sessions are using the same instance of the graph g
, and the two separate variable are due to only the two separate sessions.
B) With the instantiation of two distinct sessions, the two threads use the same architecture of the graph g
, but two separate instantiations of graph g
are created, leading to two distinct variables.