From 59750dcc8377b30346f9a66ae2240382900270af Mon Sep 17 00:00:00 2001 From: Ryan Nett Date: Wed, 28 Apr 2021 15:25:53 -0700 Subject: [PATCH] Rebase, use try-with-resources Signed-off-by: Ryan Nett --- .../src/main/java/org/tensorflow/GraphOperationBuilder.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/GraphOperationBuilder.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/GraphOperationBuilder.java index 3a43e478a69..26f84ab06c1 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/GraphOperationBuilder.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/GraphOperationBuilder.java @@ -65,15 +65,12 @@ public final class GraphOperationBuilder implements OperationBuilder { GraphOperationBuilder(Graph graph, String type, String name, boolean dangerousGradientBuilder) { this.graph = graph; this.dangerousGradientBuilder = dangerousGradientBuilder; - Graph.Reference r = graph.ref(); - try { + try (Graph.Reference r = graph.ref()) { if (dangerousGradientBuilder) { this.unsafeNativeHandle = allocateDangerousGradient(r.nativeHandle(), type, name); } else { this.unsafeNativeHandle = allocate(r.nativeHandle(), type, name); } - } finally { - r.close(); } }