Tensorflow
Tensorflow interop Key features and brief samples.
File f = new File ("path/to/your/model.pb");
INDArray x = Nd4j.scalar(1.0f).reshape(1,1);
INDArray y = Nd4j.scalar(1.0f).reshape(1,1);
List<String> inputNames = Arrays.asList("x","y");
List<String> outputNames = Arrays.asList("z");
GraphRunner tensorflowRunner = GraphRunner.builder()
.inputNames(inputNames)
.graphPath(f)
.outputNames(outputNames).
build();
Map<String,INDArray> inputs = new LinkedHashMap<>();
inputs.put("x",x);
inputs.put("y",y);
Map<String, INDArray> exec = tensorflowRunner.exec(inputs);
INDArray z = exec.get("z");Was this helpful?