I've exported an scikit RandomForestClassifier model to ONNX using WinMLTools. When I tried to import the file using ONNXRuntime (on C#). I get the following error:
System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
This happens after the 2nd output name (="probabilities") is passed to:
NativeMethods.OrtCastTypeInfoToTensorInfo(typeInfo)
and it results with IntPtr of address 0x000000000.
The input parameter and the 1st output parameter are going as planned.
The output of the model is an array of floats so I don't understand what could be the problem.
Full call stack:
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