1

我使用 WinMLTools 将 scikit RandomForestClassifier 模型导出到 ONNX。当我尝试使用 ONNXRuntime(在 C# 上)导入文件时。我收到以下错误:

System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'

这发生在第二个输出名称 (="probabilities") 传递给:

NativeMethods.OrtCastTypeInfoToTensorInfo(typeInfo)

结果是地址为 0x000000000 的 IntPtr。

输入参数和第一个输出参数按计划进行。

模型的输出是一个浮点数组,所以我不明白可能是什么问题。

完整的调用堆栈:

   at Microsoft.ML.OnnxRuntime.NativeMethods.OrtGetTensorElementType(IntPtr typeAndShapeInfo)
   at Microsoft.ML.OnnxRuntime.InferenceSession.GetMetadataFromTypeInfo(IntPtr typeInfo) in C:\agent\_work\7\s\csharp\src\Microsoft.ML.OnnxRuntime\InferenceSession.cs:line 305
4

0 回答 0