Share via


LearningModel.LoadFromStorageFileAsync Méthode

Définition

Surcharges

LoadFromStorageFileAsync(IStorageFile, ILearningModelOperatorProvider)

Charge un modèle ONNX à partir d’un IStorageFile de manière asynchrone.

LoadFromStorageFileAsync(IStorageFile)

Charge un modèle ONNX à partir d’un IStorageFile de manière asynchrone.

LoadFromStorageFileAsync(IStorageFile, ILearningModelOperatorProvider)

Charge un modèle ONNX à partir d’un IStorageFile de manière asynchrone.

public:
 static IAsyncOperation<LearningModel ^> ^ LoadFromStorageFileAsync(IStorageFile ^ modelFile, ILearningModelOperatorProvider ^ operatorProvider);
/// [Windows.Foundation.Metadata.Overload("LoadFromStorageFileWithOperatorProviderAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<LearningModel> LoadFromStorageFileAsync(IStorageFile const& modelFile, ILearningModelOperatorProvider const& operatorProvider);
[Windows.Foundation.Metadata.Overload("LoadFromStorageFileWithOperatorProviderAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<LearningModel> LoadFromStorageFileAsync(IStorageFile modelFile, ILearningModelOperatorProvider operatorProvider);
function loadFromStorageFileAsync(modelFile, operatorProvider)
Public Shared Function LoadFromStorageFileAsync (modelFile As IStorageFile, operatorProvider As ILearningModelOperatorProvider) As IAsyncOperation(Of LearningModel)

Paramètres

modelFile
IStorageFile

Emplacement du fichier de modèle.

Retours

LearningModel basé sur le fichier de modèle.

Attributs

Remarques

Windows Server

Pour utiliser cette API sur Windows Server, vous devez utiliser Windows Server 2019 avec Expérience de bureau.

Sécurité des threads

Cette API est thread-safe.

S’applique à

LoadFromStorageFileAsync(IStorageFile)

Charge un modèle ONNX à partir d’un IStorageFile de manière asynchrone.

public:
 static IAsyncOperation<LearningModel ^> ^ LoadFromStorageFileAsync(IStorageFile ^ modelFile);
/// [Windows.Foundation.Metadata.Overload("LoadFromStorageFileAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<LearningModel> LoadFromStorageFileAsync(IStorageFile const& modelFile);
[Windows.Foundation.Metadata.Overload("LoadFromStorageFileAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<LearningModel> LoadFromStorageFileAsync(IStorageFile modelFile);
function loadFromStorageFileAsync(modelFile)
Public Shared Function LoadFromStorageFileAsync (modelFile As IStorageFile) As IAsyncOperation(Of LearningModel)

Paramètres

modelFile
IStorageFile

Emplacement du fichier de modèle.

Retours

LearningModel basé sur le fichier de modèle.

Attributs

Exemples

L’exemple suivant charge le modèle et crée une session d’evaulation avec celui-ci.

private async Task LoadModelAsync(string _modelFileName)
{
    LearningModel _model;
    LearningModelSession _session;

    try
    {
        // Load and create the model
        var modelFile = 
            await StorageFile.GetFileFromApplicationUriAsync(new Uri($"ms-appx:///Assets/{_modelFileName}"));
        _model = await LearningModel.LoadFromStorageFileAsync(modelFile);

        // Create the evaluation session with the model
        _session = new LearningModelSession(_model);

    }
    catch (Exception ex)
    {
        StatusBlock.Text = $"error: {ex.Message}";
        _model = null;
    }
}

Remarques

Windows Server

Pour utiliser cette API sur Windows Server, vous devez utiliser Windows Server 2019 avec Expérience de bureau.

Sécurité des threads

Cette API est thread-safe.

S’applique à