Is it thread-safe when using tf.Session in inference service?
This video explains
Is it thread-safe when using tf.Session in inference service?
--
Become part of the top 3% of the developers by applying to Toptal
https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Quirky Dreamscape Looping
--
Chapters
00:00 Question
00:34 Accepted answer (Score 18)
01:18 Thank you
--
Full question
https://stackoverflow.com/questions/3869...
Accepted answer links:
[Session.run()]: https://www.tensorflow.org/versions/r0.1...
[sess.graph.finalize()]: https://www.tensorflow.org/versions/r0.1...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #multithreading #tensorflow #tensorflowserving
#avk47
Is it thread-safe when using tf.Session in inference service?
--
Become part of the top 3% of the developers by applying to Toptal
https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Quirky Dreamscape Looping
--
Chapters
00:00 Question
00:34 Accepted answer (Score 18)
01:18 Thank you
--
Full question
https://stackoverflow.com/questions/3869...
Accepted answer links:
[Session.run()]: https://www.tensorflow.org/versions/r0.1...
[sess.graph.finalize()]: https://www.tensorflow.org/versions/r0.1...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #multithreading #tensorflow #tensorflowserving
#avk47
ACCEPTED ANSWER
Score 18
The tf.Session object is thread-safe for Session.run() calls from multiple threads.
Before TensorFlow 0.10 graph modification was not thread-safe. This was fixed in the 0.10 release, so you can add nodes to the graph concurrently with Session.run() calls, although this is not advised for performance reasons; instead, it is recommended to call sess.graph.finalize() before using the session from multiple threads, to prevent accidental memory leaks.