Skip to content

Commit 59750dc

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

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
@@ -65,15 +65,12 @@ public final class GraphOperationBuilder implements OperationBuilder {
6565
GraphOperationBuilder(Graph graph, String type, String name, boolean dangerousGradientBuilder) {
6666
this.graph = graph;
6767
this.dangerousGradientBuilder = dangerousGradientBuilder;
68-
Graph.Reference r = graph.ref();
69-
try {
68+
try (Graph.Reference r = graph.ref()) {
7069
if (dangerousGradientBuilder) {
7170
this.unsafeNativeHandle = allocateDangerousGradient(r.nativeHandle(), type, name);
7271
} else {
7372
this.unsafeNativeHandle = allocate(r.nativeHandle(), type, name);
7473
}
75-
} finally {
76-
r.close();
7774
}
7875
}
7976

0 commit comments

Comments
 (0)