共用方式為


IMLFeatureProvider 介面

定義

定義輸入或輸出功能的介面,並允許存取其值。

[Foundation.Protocol(Name="MLFeatureProvider", WrapperType=typeof(CoreML.MLFeatureProviderWrapper))]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.WatchOS, 4, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.TvOS, 11, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.MacOSX, 10, 13, ObjCRuntime.PlatformArchitecture.Arch64, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 11, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public interface IMLFeatureProvider : IDisposable, ObjCRuntime.INativeObject
type IMLFeatureProvider = interface
    interface INativeObject
    interface IDisposable
衍生
屬性
實作

備註

CoreML 不會直接讀取和寫入系統原生資料。 而是使用這個類別,將字串對應至 物件的輸入和輸出 MLModel 值。

下列範例顯示 T:Monotouch.CoreML.IMLFeatureProvider,提供 3 個輸入變數,所有類型 double

public class MarsHabitatPricerInput : NSObject, IMLFeatureProvider
{
	public double SolarPanels { get; set; }
	public double Greenhouses { get; set; }
	public double Size { get; set; }

	public NSSet<NSString> FeatureNames => new NSSet<NSString>(new NSString("solarPanels"), new NSString("greenhouses"), new NSString("size"));

	public MLFeatureValue GetFeatureValue(string featureName)
	{
		switch (featureName)
		{
			case "solarPanels":
				return MLFeatureValue.Create(SolarPanels);
			case "greenhouses":
				return MLFeatureValue.Create(Greenhouses);
			case "size":
				return MLFeatureValue.Create(Size);
			default:
				return MLFeatureValue.Create(0);
		}
	}
}

屬性

FeatureNames

功能的名稱,如 所 MLModel 定義。

Handle

處理非受控物件標記法) (指標。

(繼承來源 INativeObject)

方法

GetFeatureValue(String)

擷取 的值。

適用於