Get ONNX Runtime Version using C++

Get ONNX Runtime Version using C++

Knowing the ONNX Runtime version helps you take advantage of the new features and improvements introduced in each release. Also, ONNX Runtime version can be useful for troubleshooting and debugging purposes. If you encounter any issues while working with ONNX models, knowing the version allows you to investigate whether it's related to a specific version's known issues. This tutorial explains how to get ONNX Runtime version using C++.

In the following code, we retrieve a string containing the version information of the ONNX Runtime, which is assigned to the variable. Next, the version is printed to the console.

#include <iostream>
#include <onnxruntime_cxx_api.h>

int main()
    std::string version = Ort::GetVersionString();

    std::cout << version << std::endl;

    return 0;

The version follows the format major.minor.revision. Here's an example of what the output could look like:


Leave a Comment

Cancel reply

Your email address will not be published.