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

IModelInferEnginePredict 方法

Performs model prediction/inference on the input tensor. 对输入张量执行模型预测/推理

Definition

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

参数

input  DataTensor
Input data tensor containing properly formatted model inputs. Must match the model's expected input shape and data type. 包含正确格式化模型输入的输入数据张量。 必须与模型预期的输入形状和数据类型匹配。

返回值

DataTensor
Output data tensor containing model predictions/results. The shape and type depends on model architecture. 包含模型预测/结果的输出数据张量。 其形状和类型取决于模型架构。

示例

C#
using var engine = new OnnxRuntimeEngine();
engine.LoadModel(ref config);
var output = engine.Predict(inputTensor);

异常

ArgumentNullException Thrown when input tensor is null. 当输入张量为null时抛出。
InvalidOperationException Thrown when model is not loaded or initialized. 当模型未加载或初始化时抛出。
ArgumentException Thrown when input tensor doesn't match model requirements. 当输入张量不符合模型要求时抛出。

参见