Langage

ExecutionProviderCatalog Classe

Définition

Fournit des méthodes permettant de découvrir, d’acquérir et d’inscrire des fournisseurs d’exécution IA à utiliser avec le runtime ONNX.

ExecutionProviderCatalog gère la complexité de la gestion des packages et de la sélection matérielle, et il s'agit du point d'entrée de votre application pour accéder à l'accélération machine learning optimisée par le matériel via le runtime ML Windows.

public ref class ExecutionProviderCatalog sealed
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Windows.AI.MachineLearning.MachineLearningContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ExecutionProviderCatalog final
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Windows.AI.MachineLearning.MachineLearningContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ExecutionProviderCatalog
Public NotInheritable Class ExecutionProviderCatalog
Héritage
Object Platform::Object IInspectable ExecutionProviderCatalog
Attributs

Exemples

// Get the default catalog
var catalog = Microsoft.Windows.AI.MachineLearning.ExecutionProviderCatalog.GetDefault();
// Ensure and register all compatible execution providers
await catalog.EnsureAndRegisterCertifiedAsync();
// Use ONNX Runtime directly for inference (using Microsoft.ML.OnnxRuntime namespace)
// Get the default catalog
winrt::Microsoft::Windows::AI::MachineLearning::ExecutionProviderCatalog catalog = 
    winrt::Microsoft::Windows::AI::MachineLearning::ExecutionProviderCatalog::GetDefault();
// Ensure and register all compatible execution providers
catalog.EnsureAndRegisterCertifiedAsync().get();
// Use ONNX Runtime C API directly for inference
import winui3.microsoft.windows.ai.machinelearning as winml
# Get the default catalog
catalog = winml.ExecutionProviderCatalog.get_default()
# DO NOT call winml's register methods in Python. Those will not work for the onnxruntime Python environment.
# Instead, register execution providers following this pattern:
providers = catalog.find_all_providers()
    for provider in providers:
        provider.ensure_ready_async().get()
        ort.register_execution_provider_library(provider.name, provider.library_path)

Méthodes

Nom Description
EnsureAndRegisterCertifiedAsync()

Fournit des méthodes permettant de découvrir, d’acquérir et d’inscrire des fournisseurs d’exécution IA à utiliser avec le runtime ONNX.

ExecutionProviderCatalog gère la complexité de la gestion des packages et de la sélection matérielle, et il s'agit du point d'entrée de votre application pour accéder à l'accélération machine learning optimisée par le matériel via le runtime ML Windows.

FindAllProviders()

Récupère une collection de tous les fournisseurs d’exécution compatibles avec le matériel actuel.

GetDefault()

Récupère l’instance ExecutionProviderCatalog par défaut qui fournit l’accès à tous les fournisseurs d’exécution sur le système.

RegisterCertifiedAsync()

Inscrit tous les fournisseurs d’exécution compatibles avec le runtime ONNX sans s’assurer qu’ils sont prêts. Cela inscrit uniquement les fournisseurs qui sont déjà présents sur l’ordinateur, ce qui évite les temps de téléchargement potentiellement longs qui peuvent être requis par EnsureAndRegisterCertifiedAsync.

S’applique à