onnx_run: Run ONNX model inference

View source: R/onnx.R

onnx_runR Documentation

Run ONNX model inference

Description

Run ONNX model inference

Usage

onnx_run(model, inputs)

Arguments

model

An onnx_model object from onnx_load().

inputs

A named list of numeric vectors/matrices. Names must match the model's input tensor names. Use onnx_inputs() to see expected names and shapes.

Value

A named list of output tensors: numeric vectors carrying a dim attribute when the output has more than one dimension.

The buffers are row-major, as ONNX stores them, so dim is given in storage order – fastest-varying axis first – which is the reverse of the shape the ONNX file declares. An output declared [nbox, 4] arrives as dim = c(4, nbox), one detection per column. This keeps dim an honest description of the memory, so ordinary R indexing is correct; use predict.onnx_model to get arrays in the declared ONNX order instead.


ggmlR documentation built on Oct. 23, 2026, 1:07 a.m.