Skip to content

Commit 1f1ba2c

Browse files
committed
Rebase, use try-with-resources
Signed-off-by: Ryan Nett <[email protected]>
1 parent 12d579c commit 1f1ba2c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/GraphOperationBuilder.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,12 @@ public final class GraphOperationBuilder implements OperationBuilder {
7474
this.graph = graph;
7575
this.scope = scope;
7676
this.dangerousGradientBuilder = dangerousGradientBuilder;
77-
Graph.Reference r = graph.ref();
78-
try {
77+
try (Graph.Reference r = graph.ref()) {
7978
if (dangerousGradientBuilder) {
8079
this.unsafeNativeHandle = allocateDangerousGradient(r.nativeHandle(), type, name);
8180
} else {
8281
this.unsafeNativeHandle = allocate(r.nativeHandle(), type, name);
8382
}
84-
} finally {
85-
r.close();
8683
}
8784
}
8885

0 commit comments

Comments
 (0)