共用方式為


LearningModel.Description 屬性

定義

模型的描述。

public:
 property Platform::String ^ Description { Platform::String ^ get(); };
winrt::hstring Description();
public string Description { get; }
var string = learningModel.description;
Public ReadOnly Property Description As String

屬性值

String

Platform::String

winrt::hstring

模型的描述。

範例

下列範例會從本機檔案載入模型、將模型描述輸出至應用程式的 UI,並從模型建立會話。

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);

        //Output the model description to application UI
        StatusBlock.Text = $"Model Description: {_model.Description}";

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

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

備註

Windows Server

若要在 Windows Server 上使用此 API,您必須搭配桌面體驗使用 Windows Server 2019。

執行緒安全

此 API 是安全線程。

適用於