InferencingOptionsPreview.PreferredDeviceKind 属性

定义

已弃用。 获取或设置将执行评估的首选设备。

public:
 property LearningModelDeviceKindPreview PreferredDeviceKind { LearningModelDeviceKindPreview get(); void set(LearningModelDeviceKindPreview value); };
LearningModelDeviceKindPreview PreferredDeviceKind();

void PreferredDeviceKind(LearningModelDeviceKindPreview value);
/// [get: Windows.Foundation.Metadata.Deprecated("Use LearningModel instead of IInferencingOptionsPreview. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 131072, "Windows.AI.MachineLearning.Preview.MachineLearningPreviewContract")]
/// [set: Windows.Foundation.Metadata.Deprecated("Use LearningModel instead of IInferencingOptionsPreview. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 131072, "Windows.AI.MachineLearning.Preview.MachineLearningPreviewContract")]
LearningModelDeviceKindPreview PreferredDeviceKind();

void PreferredDeviceKind(LearningModelDeviceKindPreview value);
public LearningModelDeviceKindPreview PreferredDeviceKind { get; set; }
public LearningModelDeviceKindPreview PreferredDeviceKind { [Windows.Foundation.Metadata.Deprecated("Use LearningModel instead of IInferencingOptionsPreview. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 131072, "Windows.AI.MachineLearning.Preview.MachineLearningPreviewContract")] get; [Windows.Foundation.Metadata.Deprecated("Use LearningModel instead of IInferencingOptionsPreview. For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 131072, "Windows.AI.MachineLearning.Preview.MachineLearningPreviewContract")] set; }
var learningModelDeviceKindPreview = inferencingOptionsPreview.preferredDeviceKind;
inferencingOptionsPreview.preferredDeviceKind = learningModelDeviceKindPreview;
Public Property PreferredDeviceKind As LearningModelDeviceKindPreview

属性值

首选设备。 默认值为 LearningDeviceAny。

属性

示例

public void SetEvaluationOptionsForModel(LearningModelPreview model)
{
    // Set our preference to use the GPU
    InferencingOptionsPreview options = model.InferencingOptions;
    options.PreferredDeviceKind = LearningModelDeviceKindPreview.LearningDeviceGpu;

    model.InferencingOptions = options;
}

注解

警告

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

适用于