| Type: | Package |
| Title: | Native 'R' 'ONNX' Runtime |
| Version: | 0.1.2 |
| 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/. |
| License: | MIT + file LICENSE |
| Language: | en-US |
| Encoding: | UTF-8 |
| LinkingTo: | Rcpp |
| Imports: | Rcpp, digest, glue |
| Config/roxygen2/version: | 8.0.0 |
| SystemRequirements: | libonnxruntime (>= 1.20) |
| Suggests: | ggplot2, knitr, rmarkdown |
| VignetteBuilder: | knitr |
| URL: | https://github.com/calebmcarr/nativeORT |
| BugReports: | https://github.com/calebmcarr/nativeORT/issues |
| NeedsCompilation: | yes |
| Packaged: | 2026-05-07 01:44:21 UTC; calebcarr |
| Author: | Caleb Carr [aut, cre] |
| Maintainer: | Caleb Carr <calebmcarr1@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-05-12 19:20:08 UTC |
ort_binary_url
Description
ort_binary_url
Usage
ort_binary_url()
Value
string where to download onnxruntime from
Examples
ort_binary_url()
ort_codesign
Description
for macs, signs the downloaded binaries
Usage
ort_codesign(lib_dir)
Arguments
lib_dir |
where the libraries are |
Value
invisible lib path
Examples
if(!ort_is_installed()){
ort_codesign(file.path(ort_install_dir(), "lib"))
}
ort_detect_os
Description
ort_detect_os
Usage
ort_detect_os()
Value
str - platform
Examples
ort_detect_os()
ort_download
Description
ort_download
Usage
ort_download(url, dest_dir)
Arguments
url |
where to download from |
dest_dir |
where to download to |
Value
invisible dest_dir
Examples
if (!ort_is_installed()){
ort_download(ort_binary_url(), ort_install_dir())}
ort_infer_raw
Description
ort_infer_raw
Usage
ort_infer_raw(session, input)
Arguments
session |
ORT session |
input |
tensor to infer on |
Value
ORT output
Examples
if (file.exists("model.onnx")) {
session <- ort_session("model.onnx")
input <- array(runif(1 * 3 * 256 * 256), dim = c(1L, 3L, 256L, 256L))
ort_infer_raw(session, input)
}
ort_install
Description
ort_install
Usage
ort_install()
Value
invisible where it was saved to
Examples
if(!ort_is_installed()){
ort_install()}
ort_install_dir
Description
ort_install_dir
Usage
ort_install_dir()
Value
where the install lives
Examples
ort_install_dir()
ort_is_installed
Description
ort_is_installed
Usage
ort_is_installed()
Value
boolean for if you have onnx runtime or not
Examples
ort_is_installed()
session.R
Description
session.R
Usage
ort_session(
path,
type = "detection",
provider = "cpu",
cache_dir = NULL,
threads = 0L,
opt_level = 99L
)
Arguments
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 |
Value
ORT session object
Examples
if (file.exists('./yolov11n.onnx')) {
ort_session('./yolov11n.onnx', 'detection')
}
print.ort_session
Description
print.ort_session
Usage
## S3 method for class 'ort_session'
print(x, ...)
Arguments
x |
session object |
... |
extra params |
Value
invisible session
Examples
if (file.exists("model.onnx")) {
session <- ort_session("model.onnx")
print(session)
}