Java: how long should I use a session #16712
-
Hi, currently we create a session for every execution of our onnx model, which we already read is not advised. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The session object owns the model and should be a long lived object. If your JVM is up for weeks and you need inferences constantly during that time I don't see a reason not to keep the session up. If your inference needs are bursty then you can bring up a session and tear it down when the burst passes. |
Beta Was this translation helpful? Give feedback.
The session object owns the model and should be a long lived object. If your JVM is up for weeks and you need inferences constantly during that time I don't see a reason not to keep the session up. If your inference needs are bursty then you can bring up a session and tear it down when the burst passes.