Please use. NET 5,. NET 6, NET 7,. NET 8, NET Framework 4.6, NET Framework 4.61, NET Framework 4.7, NET Framework 4.72, NET Framework 4.8, NET Framework 4.81, and. NET Core 3.1 versions

OnnxRuntimeInferEnginePredict 方法

Executes model inference/prediction using the provided input tensor 使用提供的输入张量执行模型推理/预测

Definition

命名空间: DeploySharp.Engine
程序集: DeploySharp (在 DeploySharp.dll 中) 版本:0.0.4+6e8a2e904469617cd59619d666c0e272985c0e33
C#
public DataTensor Predict(
	DataTensor inputs
)

参数

inputs  DataTensor
Input data tensor containing all required model inputs 包含所有必需模型输入的输入数据张量

返回值

DataTensor
Output tensor containing model predictions 包含模型预测结果的输出张量

实现

IModelInferEnginePredict(DataTensor)

备注

Supports the following tensor data types: - Float32 (System.Single) - Int32 (System.Int32) - Bool (System.Boolean converted to byte) 支持以下张量数据类型: - Float32 (System.Single) - Int32 (System.Int32) - Bool (System.Boolean转为byte)

Handles dynamic output shapes automatically when configured 在配置时自动处理动态输出形状

Typical inference workflow: 1. Validate inputs 2. Convert input tensors to ONNX Runtime format 3. Execute session.Run() 4. Process and convert outputs 典型的推理工作流程: 1. 验证输入 2. 将输入张量转换为ONNX Runtime格式 3. 执行session.Run() 4. 处理和转换输出

异常

ArgumentNullException Thrown when input tensor is null or empty 当输入张量为null或空时抛出
InvalidOperationException Thrown when: - Model is not loaded - Input shape/type mismatch - Output processing fails 以下情况抛出: - 模型未加载 - 输入形状/类型不匹配 - 输出处理失败
NotSupportedException Thrown for unsupported tensor data types 当遇到不支持的张量数据类型时抛出

参见