-
-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thread safety #76
Comments
Hi @alimoeeny thank you for the kind words! Honestly, I have never tested multiple inferences of the same model in multiple go routines. I guess, being the forward pass handled by the C library, the TensorFlow backend should already handle the concurrency - but it's just a guess. Now that I'm thinking about it (keep this message as a stream of consciousness from my side lol), I guess it's instead the exact opposite. The thread safety is left to the user in the C library - and this would make sense. Because the nature of the SavedModel is complex. There could be SavedModel stateful (where, for example, the TensorFlow program updates internal For this reason, the best thing to do is to left to the user the hassle of handling the multi-threading stuff. If your SavedModel is stateless, who cares about thread safety, otherwise you should handle it 🤔 Keep this message for what it is - just some thoughts about this topic. The best thing to do is to experiment. If you can do it, everyone that uses tfgo will benefit from your tests (right now I'm busy working on a different Go software 😅 ) |
thank you very much @galeone |
Hi @galeone
Thanks for all the hard work.
Was wondering if
tfgo.Model
is "thread safe".Specifically can I call
tfgo.Exec
from different goroutines ? are there any considerations ? I assume I at least need to keep the scopes separate?Thank you again for keeping this repo up to date.
The text was updated successfully, but these errors were encountered: