ONNX Import
Importing ONNX models into SameDiff
ONNX Import
Maven Dependency
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-samediff-import-onnx</artifactId>
<version>${dl4j.version}</version>
</dependency>Exporting an ONNX Model
import torch
import torch.onnx
model = MyModel()
model.eval()
dummy_input = torch.randn(1, 3, 224, 224)
torch.onnx.export(
model,
dummy_input,
"model.onnx",
opset_version=11,
input_names=["input"],
output_names=["output"]
)Importing an ONNX Model
Running Inference
Inspecting the Graph
Supported ONNX Ops
Supported ONNX Opsets
Complete Example: ResNet-50 Inference
Troubleshooting
Last updated
Was this helpful?