1

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
Nissim
  • 6,395
  • 5
  • 49
  • 74
  • What's the size of the onnx file? Was the export succesful, not corrupt? – Vivek Kumar Feb 27 '19 at 15:07
  • @VivekKumar around KB. No errors/warning during the export. I was also able to import it in python so I guess it's not corrupted – Nissim Feb 27 '19 at 16:24
  • 2
    Hi, I'm a developer of onnxruntime. It's something we haven't implemented at that time point, for C#. I'm sorry for the inconvenience to you. Could you please try the latest release again? I guess it has been fixed in https://github.com/microsoft/onnxruntime/pull/585 – Changming Sun Jun 09 '19 at 04:09

0 Answers0