torch::jit::load(filename, device_type);在debug不报错,但是release时报错

libtorch运行时,加载模型torch::jit::load(filename, device_type);在debug不报错,但是release时报错。
开发环境:VS2022

主要代码如下:

    std::string filename = "weights\\resnet34_cpu.pt";

    torch::DeviceType device_type = at::kCPU; // 定义设备类型
    //读取图片 
    auto image = cv::imread("flower.jpg");
    //缩放至指定大小 
    cv::resize(image, image, cv::Size(224, 224));
    //转成张量 
    auto input_tensor = torch::from_blob(image.data, { image.rows, image.cols, 3 }, torch::kByte).permute({ 2, 0, 1 }).unsqueeze(0).to(torch::kFloat32) / 225.0;
    //加载模型 
    auto model = torch::jit::load(filename, device_type);//**报错的代码@**

vs的debug和release在2个不同的文件夹,filename里的文件夹需要复制一份过去