MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / close

Method close

tensorflow/java/src/main/java/org/tensorflow/Session.java:90–109  ·  view source on GitHub ↗

Release resources associated with the Session. Blocks until there are no active executions (Session.Runner#run() calls). A Session is not usable after close returns.

()

Source from the content-addressed store, hash-verified

88 * is not usable after close returns.
89 */
90 @Override
91 public void close() {
92 graphRef.close();
93 synchronized (nativeHandleLock) {
94 if (nativeHandle == 0) {
95 return;
96 }
97 while (numActiveRuns > 0) {
98 try {
99 nativeHandleLock.wait();
100 } catch (InterruptedException e) {
101 Thread.currentThread().interrupt();
102 // Possible leak of the Session and Graph in this case?
103 return;
104 }
105 }
106 delete(nativeHandle);
107 nativeHandle = 0;
108 }
109 }
110
111 /**
112 * Run {@link Operation}s and evaluate {@link Tensor Tensors}.

Calls 3

deleteMethod · 0.95
closeMethod · 0.65
waitMethod · 0.45