Skip to content

Commit 36a6e30

Browse files
committed
Add note about why gradientFuncs is required
Signed-off-by: Ryan Nett <JNett96@gmail.com>
1 parent fd2609d commit 36a6e30

File tree

1 file changed

+5
-1
lines changed
  • tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ private TensorFlow() {}
151151
}
152152
}
153153

154-
// to keep them from getting GC'd
154+
/**
155+
* Keeps references to custom gradient functions to prevent them from being deallocated.
156+
*
157+
* <b>Required for correctness</b>
158+
*/
155159
private static final Set<GradFunc> gradientFuncs =
156160
Collections.newSetFromMap(new IdentityHashMap<>());
157161

0 commit comments

Comments
 (0)