% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/onnx.R
\name{onnx_load}
\alias{onnx_load}
\title{Load an ONNX model}
\usage{
onnx_load(
  path,
  device = NULL,
  input_shapes = NULL,
  n_threads = NULL,
  dtype = "f32"
)
}
\arguments{
\item{path}{Path to .onnx file.}

\item{device}{Backend device: \code{"vulkan"} (default if available)
or \code{"cpu"}.}

\item{input_shapes}{Optional named list of integer vectors specifying
fixed shapes for inputs with dynamic dimensions. Names must match
input tensor names. Each shape must include all dimensions including
batch, e.g. \code{list(image = c(1L, 3L, 224L, 224L))}.
Required when the model has dynamic dimensions and no default shape.}

\item{n_threads}{Number of CPU threads. \code{NULL} (default) reads
\code{getOption("ggmlR.n_threads")}; if that is also unset, uses
\code{parallel::detectCores() - 1} (minimum 1).}

\item{dtype}{Weight precision: \code{"f32"} (default) or \code{"f16"}.
When \code{"f16"}, large weight tensors (>= 256 elements) are stored
in half-precision for faster Vulkan compute and lower VRAM usage.
Small tensors (bias, scalars, batch-norm params) remain in F32
for numerical stability. Inputs and outputs are always F32.}
}
\value{
An opaque model object (external pointer) for use with
  \code{onnx_run()}, \code{onnx_summary()}, and \code{onnx_inputs()}.
}
\description{
Parses an .onnx file, builds a ggml computation graph, and allocates
tensors on the specified device. Weights are loaded via memory-mapped
file (zero-copy where possible).
}
