Share via


LearningModelPreview.LoadModelFromStorageFileAsync(IStorageFile) 方法

定义

已弃用。 从文件存储异步加载模型。

public:
 static IAsyncOperation<LearningModelPreview ^> ^ LoadModelFromStorageFileAsync(IStorageFile ^ modelFile);
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<LearningModelPreview> LoadModelFromStorageFileAsync(IStorageFile const& modelFile);
/// [Windows.Foundation.Metadata.RemoteAsync]
/// [Windows.Foundation.Metadata.Deprecated("Use ILearningModelStatics instead of ILearningModelPreviewStatics. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 131072, "Windows.AI.MachineLearning.Preview.MachineLearningPreviewContract")]
 static IAsyncOperation<LearningModelPreview> LoadModelFromStorageFileAsync(IStorageFile const& modelFile);
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<LearningModelPreview> LoadModelFromStorageFileAsync(IStorageFile modelFile);
[Windows.Foundation.Metadata.RemoteAsync]
[Windows.Foundation.Metadata.Deprecated("Use ILearningModelStatics instead of ILearningModelPreviewStatics. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 131072, "Windows.AI.MachineLearning.Preview.MachineLearningPreviewContract")]
public static IAsyncOperation<LearningModelPreview> LoadModelFromStorageFileAsync(IStorageFile modelFile);
function loadModelFromStorageFileAsync(modelFile)
Public Shared Function LoadModelFromStorageFileAsync (modelFile As IStorageFile) As IAsyncOperation(Of LearningModelPreview)

参数

modelFile
IStorageFile

模型文件的位置。

返回

返回 LearningModelPreview。

属性

示例

public async Task LoadModel()
{
    var modelFile = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("model.onnx");
    LearningModelPreview model = await LearningModelPreview.LoadModelFromStorageFileAsync(modelFile);
}

注解

警告

这是一个已弃用的 API。 请改用 Windows.AI.MachineLearning 命名空间。

适用于