summaryrefslogtreecommitdiff
path: root/gnu/packages/machine-learning.scm
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@friendly-machines.com>2026-02-13 22:58:38 +0100
committerDanny Milosavljevic <dannym@friendly-machines.com>2026-03-07 03:09:48 +0100
commitdd9028f67a7cfcc4fb144bdf614a3e950ca63c22 (patch)
treeaaba673ecb325da825bdc80ff503e8df86a63fd6 /gnu/packages/machine-learning.scm
parentc3f482bb122663b080e33183b56b7e0ac15d5071 (diff)
gnu: Add onnx-for-onnxruntime.
* gnu/packages/patches/onnx-1.17.0-for-onnxruntime.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/machine-learning.scm (onnx-1.17.0-for-onnxruntime): New variable. [source]: Use patch. Change-Id: Ib5dab812c6a0f970e65d0764a4889a3eee0ebda2
Diffstat (limited to 'gnu/packages/machine-learning.scm')
-rw-r--r--gnu/packages/machine-learning.scm39
1 files changed, 39 insertions, 0 deletions
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 3c5943961e7..6b0619f33ed 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -2080,6 +2080,45 @@ operators and standard data types.")
(define-deprecated-package python-onnx
onnx)
+(define-public onnx-for-onnxruntime
+ (package
+ (inherit onnx)
+ (name "onnx-for-onnxruntime")
+ (source
+ (origin
+ (inherit (package-source onnx))
+ (patches (append (search-patches "onnx-1.17.0-for-onnxruntime.patch")
+ (origin-patches (package-source onnx))))))
+ ;; Use cmake-build-system instead of pyproject-build-system so that
+ ;; only the C++ static library is built and installed. The Python
+ ;; onnx package (with schemas registered) is provided by regular
+ ;; onnx; this variant has ONNX_DISABLE_STATIC_REGISTRATION=ON which
+ ;; would break onnx.shape_inference if its Python files ended up on
+ ;; PYTHONPATH.
+ (build-system cmake-build-system)
+ (arguments
+ (list
+ #:tests? #f ; tests fail without schema registration
+ #:configure-flags
+ #~(list "-DBUILD_SHARED_LIBS=OFF"
+ "-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF"
+ ;; Disable ONNX's schema registration so onnxruntime
+ ;; handles it. See
+ ;; <https://onnxruntime.ai/docs/build/dependencies.html>.
+ "-DONNX_DISABLE_STATIC_REGISTRATION=ON"
+ "-DONNX_BUILD_TESTS=OFF"
+ "-DONNX_BUILD_BENCHMARKS=OFF"
+ "-DONNX_ML=ON"
+ "-DONNX_USE_LITE_PROTO=OFF"
+ "-DBUILD_ONNX_PYTHON=OFF")))
+ (inputs (list protobuf-static-for-onnxruntime))
+ (native-inputs (list python-minimal-wrapper pybind11))
+ (propagated-inputs '())
+ (description
+ "This variant of the ONNX package is built as a static C++ library
+with schema registration disabled, for linking into onnxruntime. It
+should not be used standalone.")))
+
(define-public onnx-optimizer
(package
(name "onnx-optimizer")