# Clojure Runs ONNX AI Models Now - Join the AI fun!

DevFeed: [Clojure Runs ONNX AI Models Now - Join the AI fun!](<https://devfeed.tech/articles/clojure-runs-onnx-ai-models-now-join-the-ai-fun-20727.md>)

Original publisher: [Read original article](<http://dragan.rocks/articles/25/Clojure-Runs-ONNX-AI-Models-Now>)

Published: 2025-10-26T15:56:00Z

Content type: tutorial

Language: en

Sources: [Dragan Djuric](<https://devfeed.tech/sources/dragan-djuric.md>)

Topics: [onnx](<https://devfeed.tech/topics/onnx.md>), [onnx runtime](<https://devfeed.tech/topics/onnx-runtime.md>), [AI Models](<https://devfeed.tech/topics/ai-models.md>), [Clojure](<https://devfeed.tech/topics/clojure.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [Image](<https://devfeed.tech/topics/image.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [ai-models](<https://devfeed.tech/tags/ai-models.md>), [clojure](<https://devfeed.tech/tags/clojure.md>), [deep](<https://devfeed.tech/tags/deep.md>), [diamond](<https://devfeed.tech/tags/diamond.md>), [gpu](<https://devfeed.tech/tags/gpu.md>), [gpu-computing](<https://devfeed.tech/tags/gpu-computing.md>), [jvm](<https://devfeed.tech/tags/jvm.md>), [libraries](<https://devfeed.tech/tags/libraries.md>), [ml](<https://devfeed.tech/tags/ml.md>), [ml-models](<https://devfeed.tech/tags/ml-models.md>), [model](<https://devfeed.tech/tags/model.md>), [models](<https://devfeed.tech/tags/models.md>), [onnx](<https://devfeed.tech/tags/onnx.md>), [onnx-runtime](<https://devfeed.tech/tags/onnx-runtime.md>), [python](<https://devfeed.tech/tags/python.md>), [pytorch](<https://devfeed.tech/tags/pytorch.md>), [tensors](<https://devfeed.tech/tags/tensors.md>)

## AI overview

The article presents a Clojure API that loads pretrained ONNX models through ONNX Runtime's underlying C library, with no Python runtime or Python interop required. Its `onnx` function turns a model into a component for Deep Diamond networks and tensors; the example loads an MNIST model, supplies a single 28x28 grayscale image, runs inference, and uses Neanderthal's `iamax` to select digit 7 from the output. The author says GPU support is desired through Clojure numerical libraries, while noting ONNX Runtime is for production inference and training is not available in this setup. The example is single-image and shows a simple tensor transfer, while the API also has options and clojurized access to internals that are left for later discussion.

## Source excerpt

Hello, Clojurians! I haven't written here in a long time. Was I tired? Is anybody reading blogs anymore? Who knows. But that was not the main reason. I've been working on several Clojure projects sponsored by the Clojurists Together Foundation. I did a ton of things, but after all this programming, I was kinda tired, and kept slugging when it comes to telling people about the work done! That's not very smart, but you know how it goes... :) But, then, if we don't tell people about awesome software that we have, nobody is going to use it, so finally I had to stop kicking this down the road, sit, and write the first post. It's been long overdue, so expect more posts soon! ONNX Runtime in one line of Clojure The most recent thing I'm currently working on started its life as Clojure ML (again, superthanks to Clojurists Together for sponsoring this). I proposed to create a human-friendly Clojure API for AI/DL/ML models, and back it by the first implementation, in this case based on ONNX Runtime. Of course, it should all be integrated into existing Clojure libraries, and follow the Clojure way of doing stuff as much as possible! The idea is to get an existing, pre-trained ML model previously exported to the ONNX format from whatever technology the authors chose (which in today's world is typically Python and PyTorch), and put it into production in Clojure and JVM. It should be seamless and in-process, without any clunky interoperability, copy, translation, etc. Of course, our Clojure numerical libraries fully support GPU computing, so it goes without saying that we want that, too! Just to be clear, we do not use nor need any Python or Python interop for this, we use the ONNX Runtime's underlying C library. Nice idea, but what parts of this well intended story can we evaluate in our REPLs right now? At least some promising demo? Are we on the trail? To access that AI goodness, we surely have to do a sophisticated dance? Are the steps hard to learn? Do we need to watch careful