| Title: | Native R 'ONNX' Runtime |
|---|---|
| Description: | Provides R native 'ONNX' model inference without requiring 'Python', 'reticulate' bindings, or 'TensorFlow'. This package directly binds the 'ONNX Runtime' C API via 'Rcpp', enabling real-time inference for '.onnx' engines, all within R. Standard CPU execution is supported as well as the 'CoreML' Execution Provider (CEP) for Apple Silicon, all without external bindings. This package handles OS detection, linking 'ONNX' libraries, and inference. For more information about 'ONNX Runtime' see <https://onnxruntime.ai/>. |
| Authors: | Caleb Carr [aut, cre] |
| Maintainer: | Caleb Carr <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.1 |
| Built: | 2026-05-17 16:03:44 UTC |
| Source: | https://github.com/calebmcarr/nativeort |
ort_binary_url
ort_binary_url()ort_binary_url()
string where to download onnxruntime from
## Not run: ort_binary_url()## Not run: ort_binary_url()
for macs, signs the downloaded binaries
ort_codesign(lib_dir)ort_codesign(lib_dir)
lib_dir |
where the libraries are |
invisible lib path
## Not run: ort_codesign(file.path(ort_install_dir(), "lib"))## Not run: ort_codesign(file.path(ort_install_dir(), "lib"))
ort_detect_os
ort_detect_os()ort_detect_os()
str - platform
## Not run: ort_detect_os()## Not run: ort_detect_os()
ort_download
ort_download(url, dest_dir)ort_download(url, dest_dir)
url |
where to download from |
dest_dir |
where to download to |
invisible dest_dir
## Not run: ort_download(ort_binary_url(), ort_install_dir())## Not run: ort_download(ort_binary_url(), ort_install_dir())
ort_infer_raw
ort_infer_raw(session, input)ort_infer_raw(session, input)
session |
ORT session |
input |
tensor to infer on |
ORT output
## Not run: ort_infer_raw(session, input)## Not run: ort_infer_raw(session, input)
ort_install
ort_install()ort_install()
invisible where it was saved to
## Not run: ort_install()## Not run: ort_install()
ort_install_dir
ort_install_dir()ort_install_dir()
where the install lives
## Not run: ort_install_dir()## Not run: ort_install_dir()
ort_is_installed
ort_is_installed()ort_is_installed()
boolean for if you have onnx runtime or not
## Not run: ort_is_installed()## Not run: ort_is_installed()
session.R
ort_session( path, type = "detection", provider = "cpu", cache_dir = NULL, threads = 0L, opt_level = 99L )ort_session( path, type = "detection", provider = "cpu", cache_dir = NULL, threads = 0L, opt_level = 99L )
path |
where the .onnx is located |
type |
detection/classificaton/segmentation |
provider |
cpu or coreml (only for apple silicon) |
cache_dir |
where coreml cache be directed |
threads |
= 0 for all, integer otherwise |
opt_level |
= 99 for all ops, 1 for basics |
ORT session object
## Not run: ort_session('./yolov8n.onnx', 'detection')## Not run: ort_session('./yolov8n.onnx', 'detection')
print.ort_session
## S3 method for class 'ort_session' print(x, ...)## S3 method for class 'ort_session' print(x, ...)
x |
session object |
... |
extra params |
invisible session
## Not run: print(session)## Not run: print(session)