[ANN] ONNXRunTime.jl

I am happy to announce ONNXRunTime.jl. ONNX is a file format for saving neural networks. ONNXRunTime.jl is a wrapper around onnxruntime and allows loading ONNX files and using them for inference. For instance:


julia> import ONNXRunTime as OX

julia> path = OX.testdatapath("increment2x3.onnx"); # path to a toy model

julia> model = OX.load_inference(path);

julia> input = Dict("input" => randn(Float32,2,3))
Dict{String, Matrix{Float32}} with 1 entry:
  "input" => [1.68127 1.18192 -0.474021; -1.13518 1.02199 2.75168]

julia> model(input)
Dict{String, Matrix{Float32}} with 1 entry:
  "output" => [2.68127 2.18192 0.525979; -0.135185 2.02199 3.75168]

For GPU usage simply do:

pkg> add CUDA

julia> import CUDA

julia> model = OX.load_inference(path, execution_provider=:cuda);

There is also a low level API, that mirrors the official C-API.

12 Likes