Skip to content

Commit fd2609d

Browse files
committed
More dangerous gradient builder javadocs
Signed-off-by: Ryan Nett <JNett96@gmail.com>
1 parent 72ed4f0 commit fd2609d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,12 @@ private static TF_OperationDescription allocate(TF_Graph graphHandle, String typ
436436
return TF_NewOperation(graphHandle, type, name);
437437
}
438438

439+
/**
440+
* Use builders without locking. This should only be used during custom gradient building.
441+
*
442+
* The graph locks are not re-entrant, so attempting to add an op to a graph that has
443+
* been locked by the gradient builder will fail without this.
444+
*/
439445
private static TF_OperationDescription allocateDangerousGradient(
440446
TF_Graph graphHandle, String type, String name) {
441447
if (graphHandle == null || graphHandle.isNull()) {
@@ -455,6 +461,12 @@ private static TF_Operation finish(TF_OperationDescription handle) {
455461
}
456462
}
457463

464+
/**
465+
* Use builders without locking. This should only be used during custom gradient building.
466+
*
467+
* The graph locks are not re-entrant, so attempting to add an op to a graph that has
468+
* been locked by the gradient builder will fail without this.
469+
*/
458470
private static TF_Operation finishDangerousGradient(TF_Graph g, TF_OperationDescription handle) {
459471
requireHandle(handle);
460472

0 commit comments

Comments
 (0)