Onnx
Onnx interop Key features and brief samples.
File f = new File ("path/to/your/model.onnx");
INDArray x = Nd4j.scalar(1.0f).reshape(1,1);
INDArray y = Nd4j.scalar(1.0f).reshape(1,1);
OnnxRuntimeRunner onnxRuntimeRunner = OnnxRuntimeRunner.builder()
.modelUri(f.getAbsolutePath())
.build();
Map<String,INDArray> inputs = new LinkedHashMap<>();
inputs.put("x",x);
inputs.put("y",y);
Map<String, INDArray> exec = onnxRuntimeRunner.exec(inputs);
INDArray z = exec.get("z");<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-onnxruntime</groupId>
<version>${nd4j.version}</version>
</dependency>Was this helpful?