Thread 1:
session = tf.Session()
g = tf.Graph()with g.as_default():
make_new_graph()
.. ..
session.run(tf.initialize_all_variables())
Thread 2:
session = tf.Session()
g = tf.Graph()with g.as_default():
male_new_graph()
.. ..
session.run(tf.initialize_all_variables())
--
You received this message because you are subscribed to the Google Groups "Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss+unsubscribe@tensorflow.org.
To post to this group, send email to dis...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/discuss/8f27ad94-2951-40b0-8140-963655eefe71%40tensorflow.org.
The comments apply to each instance of tf.Graph - there is no state shared between multiple instances of tf.Graph.However, since graph construction is implemented in pure Python, and Python has a Global Interpreter Lock, there is no performance benefit to constructing multiple graphs in different threads, so it might yield simpler code if you construct the graphs sequentially.Derek.
On Wed, Sep 7, 2016 at 11:27 AM, Nat Roth <natu...@gmail.com> wrote:
The docs on graph construction state:"This class is not thread-safe for graph construction. All operations should be created from a single thread, or external synchronization must be provided. Unless otherwise specified, all methods are not thread-safe."I am unclear on whether this caveat applies only to multiple threads accessing/adding ops the same graph instance, or if it means that all operations on any graph anywhere in a process must be done on a single thread. For example, in the dummy example below, two separate, new graphs are constructed, potentially in parallel, and the graphs should share no weights/memory. Is that set up thread safe?
Thread 1:
session = tf.Session()g = tf.Graph()with g.as_default():
make_new_graph()
.. ..
session.run(tf.initialize_all_variables())
Thread 2:
session = tf.Session()g = tf.Graph()with g.as_default():
male_new_graph()
.. ..
session.run(tf.initialize_all_variables())
--
You received this message because you are subscribed to the Google Groups "Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss+u...@tensorflow.org.
To post to this group, send email to dis...@tensorflow.org.