I have created an svmregressor using sklearn and skl2onnx:
initial_type = [('double_input', DoubleTensorType([None, len(d)]))]
onx = convert_sklearn(results[i].estimator_, initial_types=initial_type)
with open(r"C:\my folder\x_" + str(i) + "_1.onnx", "wb") as f:
f.write(onx.SerializeToString())
I call it in c# using
session = new InferenceSession(modelPath);
modelInputNames = session.InputMetadata.Keys.Single();
dimensions = new int[] { 1, X.Length };
DenseTensor<double> inputTensor = new DenseTensor<double>(X, dimensions);
List<NamedOnnxValue> modelInput = new List<NamedOnnxValue>
{
NamedOnnxValue.CreateFromTensor(modelInputNames, inputTensor)
};
var result = session.Run(modelInput);
var prediction = ((DenseTensor<double>)result.Single().Value).ToArray();
and I get the error in:
class NativeApiStatus
{
private static string GetErrorMessage(IntPtr /*(ONNXStatus*)*/status)
{
// nativeString belongs to status, no need for separate release
IntPtr nativeString = NativeMethods.OrtGetErrorMessage(status);
return NativeOnnxValueHelper.StringFromNativeUtf8(nativeString);
}
/// <summary>
/// Checks the native Status if the errocode is OK/Success. Otherwise constructs an appropriate exception and throws.
/// Releases the native status object, as needed.
/// </summary>
/// <param name="nativeStatus"></param>
/// <throws></throws>
public static void VerifySuccess(IntPtr nativeStatus)
{
if (nativeStatus != IntPtr.Zero)
{
try
{
ErrorCode statusCode = NativeMethods.OrtGetErrorCode(nativeStatus);
string errorMessage = GetErrorMessage(nativeStatus);
}
finally
{
NativeMethods.OrtReleaseStatus(nativeStatus);
}
}
}
}
I get this error:
Microsoft.ML.OnnxRuntime.OnnxRuntimeException HResult=0x80131500 Message=[ErrorCode:NotImplemented] Could not find an implementation for SVMRegressor(1) node with name 'SVM' Source=Microsoft.ML.OnnxRuntime StackTrace: at Microsoft.ML.OnnxRuntime.NativeApiStatus.VerifySuccess(IntPtr nativeStatus) in D:\a_work\1\s\csharp\src\Microsoft.ML.OnnxRuntime\NativeApiStatus.cs:line 31 at Microsoft.ML.OnnxRuntime.InferenceSession.Init(String modelPath, SessionOptions options, PrePackedWeightsContainer prepackedWeightsContainer) in D:\a_work\1\s\csharp\src\Microsoft.ML.OnnxRuntime\InferenceSession.cs:line 776 at Microsoft.ML.OnnxRuntime.InferenceSession..ctor(String modelPath) in D:\a_work\1\s\csharp\src\Microsoft.ML.OnnxRuntime\InferenceSession.cs:line 59 ...
can you help?