无法加载DLL“CpuMathNative”

问题描述 投票:0回答:1

我尝试在 asp webform 中进行 ML Net。我创建了模型并将我的模型放入我的网络表单中。运行程序时我收到此错误。无法加载 DLL CpuMathNative 。请回答有关依赖性的问题。

 using Microsoft.ML.Data; 
using Microsoft.ML; 
using System.IO;
 using DiabeticsML.Model;

namespace diabetics
 { 
public partial class WebForm1 : System.Web.UI.Page
 { 


    protected void Button1_Click(object sender, EventArgs e)
    {
        var mlContext = new MLContext();
       
        ITransformer model;
        using (var stream = new FileStream(@"C:\Users\Fantasy-Pc\source\repos\diabetics\diabeticsML.Model\MLModel.zip", FileMode.Open, FileAccess.Read, FileShare.Read))
        {
            model = mlContext.Model.Load(stream, out _);
        }

        // Create a new model input with the user-provided data
        var input = new ModelInput
        {
            Gender = TextBox1.Text,
            Age = float.Parse(TextBox2.Text),
            Diet = TextBox3.Text,
            Height = float.Parse(TextBox4.Text),
            Weight = float.Parse(TextBox5.Text),
            Sbp = float.Parse(TextBox6.Text),
            Bdp = float.Parse(TextBox7.Text)
        };

        // Make the prediction
        var predictionEngine = mlContext.Model.CreatePredictionEngine<ModelInput, ModelOutput>(model);
        var prediction = predictionEngine.Predict(input);

        // Display the prediction result
        Label8.Text = prediction.ToString();

    }
}

}

c# asp.net visual-studio-2019 ml.net
1个回答
0
投票

我遇到了同样的问题,在项目属性>构建选项卡下,将平台目标更改为x64,发现问题已修复。

© www.soinside.com 2019 - 2024. All rights reserved.