Skip to content

Commit ff96645

Browse files
committed
runInit() method in session
Signed-off-by: Ryan Nett <[email protected]>
1 parent 8aeeddf commit ff96645

File tree

1 file changed

+13
-0
lines changed
  • tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,19 @@ public void run(Op op) {
490490
runner().addTarget(op.op()).run();
491491
}
492492

493+
494+
/**
495+
* Execute the graph's initializers.
496+
*
497+
* <p>This method is equivalent to {@code session.runner().addTarget(Ops.create(session.graph()).init()).run()}.
498+
*
499+
*/
500+
public void runInit(){
501+
Runner runner = runner();
502+
graph.initializers().forEach(runner::addTarget);
503+
runner.run();
504+
}
505+
493506
/**
494507
* Saves the actual state of the variables of this session's graph.
495508
*

0 commit comments

Comments
 (0)