MLCompilerBridge
Tools for streamlining communication with ML models for compiler optimizations.
Loading...
Searching...
No Matches
onnx.h
Go to the documentation of this file.
1//=== MLModelRunner/ONNXModelRunner/onnx.h --- ONNX C++ Interface -----===//
2//
3// Part of the MLCompilerBridge Project, under the Apache License v2.0 with LLVM
4// Exceptions. See the LICENSE file for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===---------------------------------------------------------------------===//
13//===---------------------------------------------------------------------===//
14
15#ifndef ONNX_MODELRUNNER_ONNX_H
16#define ONNX_MODELRUNNER_ONNX_H
17
18#include "llvm/ADT/SmallVector.h"
19
20#include <cstdint>
21#include <vector>
22
23namespace Ort {
24class Env;
25class Session;
26class Value;
27} // namespace Ort
28
29class ONNXModel {
30 Ort::Env *env;
31 const char *model_path;
32 Ort::Session *session;
33 Ort::Value getInputValue(llvm::SmallVector<float, 100> &input, int inputIdx);
34
35public:
36 ONNXModel(const char *model_path);
37
39 void run(llvm::SmallVector<float, 100> &input,
40 llvm::SmallVector<float, 100> &output);
41};
42
43#endif // ONNX_MODELRUNNER_ONNX_H
const char * model_path
Definition onnx.h:31
Ort::Session * session
Definition onnx.h:32
Ort::Value getInputValue(llvm::SmallVector< float, 100 > &input, int inputIdx)
Definition onnx.cpp:29
Ort::Env * env
Definition onnx.h:30
ONNXModel(const char *model_path)
Definition onnx.cpp:24
void run(llvm::SmallVector< float, 100 > &input, llvm::SmallVector< float, 100 > &output)
Runs the ONNX model on the input and returns the output.
Definition onnx.cpp:51
Definition onnx.h:23