ML Community Day is November 9! Join us for updates from TensorFlow, JAX, and more Learn more

Graph.WhileSubgraphBuilder

public static interface Graph.WhileSubgraphBuilder

Used to instantiate an abstract class which overrides the buildSubgraph method to build a conditional or body subgraph for a while loop. After Java 8, this can alternatively be used to create a lambda for the same purpose.

To be used when calling whileLoop(Output[], org.tensorflow.Graph.WhileSubgraphBuilder, org.tensorflow.Graph.WhileSubgraphBuilder, String)

Example usage (prior to Java 8):

WhileSubgraphBuilder bodyGraphBuilder = new WhileSubgraphBuilder() { @Override public void buildSubgraph(Graph bodyGraph, Output<?>[] bodyInputs, Output<?>[] bodyOutputs) { // build body subgraph }; }

Example usage (after Java 8):

WhileSubgraphBuilder bodyGraphBuilder = (bodyGraph, bodyInputs, bodyOutputs) -> { // build body subgraph ;}

Public Methods

abstract void
buildSubgraph(Graph g, Output[]<?> inputs, Output[]<?> outputs)
To be overridden by user with code to build conditional or body subgraph for a while loop

Public Methods

public abstract void buildSubgraph (Graph g, Output[]<?> inputs, Output[]<?> outputs)

To be overridden by user with code to build conditional or body subgraph for a while loop

Parameters
g the subgraph
inputs subgraph inputs
outputs subgraph outputs