Winform使用ML.NET时无法加载 DLL“CpuMathNative”问题的解决方法

时间:2021-12-08 23:01:38

同样的代码运行在netcore下可以,运行在winform中就出现错误:

引发的异常:“System.DllNotFoundException”(位于 Microsoft.ML.Data.dll 中)

跟进代码,发现异常为:

Message = "无法加载 DLL“CpuMathNative”: 找不到指定的模块。 (异常来自 HRESULT:0x8007007E)。"

Source = "Microsoft.ML.CpuMath"

STACK TRACK:

在 Microsoft.ML.Internal.CpuMath.Thunk.DotSU(Single* pa, Single* pb, Int32* pi, Int32 c)
在 Microsoft.ML.Numeric.VectorUtils.DotProduct(VBuffer`1& a, VBuffer`1& b)
在 Microsoft.ML.Trainers.LinearMulticlassModelParametersBase.PredictCore(VBuffer`1& src, VBuffer`1& dst)
在 Microsoft.ML.Data.PredictedLabelScorerBase.EnsureCachedPosition[TScore](Int64& cachedPosition, TScore& score, DataViewRow boundRow, ValueGetter`1 scoreGetter)
在 Microsoft.ML.Data.MulticlassClassificationScorer.<>c__DisplayClass16_0.<GetPredictedLabelGetter>b__0(UInt32& dst)
在 Microsoft.ML.Transforms.KeyToValueMappingTransformer.Mapper.KeyToValueMap`2.<>c__DisplayClass8_0.<GetMappingGetter>b__0(TValue& dst)
在 Microsoft.ML.Data.TypedCursorable`1.TypedRowBase.<>c__DisplayClass10_0`1.<CreateDirectSetter>b__0(TRow row)
在 Microsoft.ML.Data.TypedCursorable`1.TypedRowBase.FillValues(TRow row)
在 Microsoft.ML.PredictionEngineBase`2.Predict(TSrc example)
...................................

百度了很久无法解决,没办法,还得上google啊,

解决方法在此:

https://github.com/dotnet/machinelearning-samples/issues/274

Winform使用ML.NET时无法加载 DLL“CpuMathNative”问题的解决方法

我的是x64自然要去win-x64目录下复制同名文件,完美解决。

Winform使用ML.NET时无法加载 DLL“CpuMathNative”问题的解决方法

标签:

原文地址:https://www.cnblogs.com/sinceret/p/11665523.html