MLCompilerBridge
Tools for streamlining communication with ML models for compiler optimizations.
Loading...
Searching...
No Matches
include
MLModelRunner
ONNXModelRunner
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
23
namespace
Ort
{
24
class
Env;
25
class
Session;
26
class
Value;
27
}
// namespace Ort
28
29
class
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
35
public
:
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
ONNXModel
Definition
onnx.h:29
ONNXModel::model_path
const char * model_path
Definition
onnx.h:31
ONNXModel::session
Ort::Session * session
Definition
onnx.h:32
ONNXModel::getInputValue
Ort::Value getInputValue(llvm::SmallVector< float, 100 > &input, int inputIdx)
Definition
onnx.cpp:29
ONNXModel::env
Ort::Env * env
Definition
onnx.h:30
ONNXModel::ONNXModel
ONNXModel(const char *model_path)
Definition
onnx.cpp:24
ONNXModel::run
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
Ort
Definition
onnx.h:23
Generated by
1.10.0