Files
FastDeploy/docs/api/runtime/runtime.md
Jason 0dd9ecee65 Optimize ocr system code (#209)
* Support PPYOLOE plus model

* Optimize ocr system code

* modify example code

* fix patchelf of openvino

* optimize demo code of ocr

* remove debug code

* update demo code of ocr

Co-authored-by: Jack Zhou <zhoushunjie@baidu.com>
2022-09-14 09:46:03 +08:00

85 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Runtime
在配置`RuntimeOption`即可基于不同后端在不同硬件上创建Runtime用于模型推理。
## Python 类
```
class Runtime(runtime_option)
```
**参数**
> * **runtime_option**(fastdeploy.RuntimeOption): 配置好的RuntimeOption类实例
### 成员函数
```
infer(data)
```
根据输入数据进行模型推理
**参数**
> * **data**(dict({str: np.ndarray}): 输入数据字典dict类型key为输入名value为np.ndarray数据类型
**返回值**
返回list, list的长度与原始模型输出个数一致list中元素为np.ndarray类型
```
num_inputs()
```
返回模型的输入个数
```
num_outputs()
```
返回模型的输出个数
## C++ 类
```
class Runtime
```
### 成员函数
```
bool Init(const RuntimeOption& runtime_option)
```
模型加载初始化
**参数**
> * **runtime_option**: 配置好的RuntimeOption实例
**返回值**
初始化成功返回true否则返回false
```
bool Infer(vector<FDTensor>& inputs, vector<FDTensor>* outputs)
```
根据输入进行推理并将结果写回到outputs
**参数**
> * **inputs**: 输入数据
> * **outputs**: 输出数据
**返回值**
推理成功返回true否则返回false
```
int NumInputs()
```
返回模型输入个数
```
input NumOutputs()
```
返回模型输出个数