Skip to content

DJL - ONNX Runtime engine implementation


This module contains the Deep Java Library (DJL) EngineProvider for ONNX Runtime.

It is based off the ONNX Runtime Deep Learning Framework.

We don't recommend developers use classes within this module directly. Use of these classes will couple your code to the ONNX Runtime and make switching between engines difficult.

ONNX Runtime is a DL library with limited support for NDArray operations. Currently, it only covers the basic NDArray creation methods. To better support the necessary preprocessing and postprocessing, you can use one of the other Engine along with it to run in a hybrid mode. For more information, see Hybrid Engine.


The latest javadocs can be found on here.

You can also build the latest javadocs locally using the following command:

# for Linux/macOS:
./gradlew javadoc

# for Windows:
..\..\gradlew javadoc

The javadocs output is generated in the build/doc/javadoc folder.

System Requirements

Read the System Requirements for the official ONNX Runtime project.


You can pull the ONNX Runtime engine from the central Maven repository by including the following dependency:

  • ai.djl.onnxruntime:onnxruntime-engine:0.27.0

This package by default depends on

Install GPU package

If you want to use GPU, you can manually exclude and add
to your project.




implementation("ai.djl.onnxruntime:onnxruntime-engine:0.27.0") {
    exclude group: "", module: "onnxruntime"
implementation ""

Enable TensorRT execution

ONNXRuntime offers TensorRT execution as the backend. In DJL, user can specify the followings in the Criteria to enable:

optOption("ortDevice", "TensorRT")