語言

CustomMappingCatalog.StatefulCustomMapping<TSrc,TDst,TState> 方法

定義

建立一個 StatefulCustomMappingEstimator<TSrc,TDst,TState>,該欄位將輸入欄位對應輸出欄位的自訂映射,同時允許每游標狀態。

public static Microsoft.ML.Transforms.StatefulCustomMappingEstimator<TSrc,TDst,TState> StatefulCustomMapping<TSrc,TDst,TState>(this Microsoft.ML.TransformsCatalog catalog, Action<TSrc,TDst,TState> mapAction, Action<TState> stateInitAction, string contractName) where TSrc : class, new() where TDst : class, new() where TState : class, new();
static member StatefulCustomMapping : Microsoft.ML.TransformsCatalog * Action<'Src, 'Dst, 'State (requires 'Src : null and 'Src : (new : unit -> 'Src) and 'Dst : null and 'Dst : (new : unit -> 'Dst) and 'State : null and 'State : (new : unit -> 'State))> * Action<'State (requires 'State : null and 'State : (new : unit -> 'State))> * string -> Microsoft.ML.Transforms.StatefulCustomMappingEstimator<'Src, 'Dst, 'State (requires 'Src : null and 'Src : (new : unit -> 'Src) and 'Dst : null and 'Dst : (new : unit -> 'Dst) and 'State : null and 'State : (new : unit -> 'State))> (requires 'Src : null and 'Src : (new : unit -> 'Src) and 'Dst : null and 'Dst : (new : unit -> 'Dst) and 'State : null and 'State : (new : unit -> 'State))
<Extension()>
Public Function StatefulCustomMapping(Of TSrc As {Class, New}, TDst As {Class, New}, TState As {Class, New}) (catalog As TransformsCatalog, mapAction As Action(Of TSrc, TDst, TState), stateInitAction As Action(Of TState), contractName As String) As StatefulCustomMappingEstimator(Of TSrc, TDst, TState)

類型參數

TSrc

定義從輸入資料中取哪些欄位的類別。

TDst

定義新增欄位的類別。

TState

描述每光標狀態的類型。

參數

catalog
TransformsCatalog

變形目錄。

mapAction
Action<TSrc,TDst,TState>

地圖動作。 除了輸入和輸出物件外,動作還會被賦予一個狀態物件,可以查看和/或修改。 若產生的變換器需要可儲存,定義類別 mapAction 應實 StatefulCustomMappingFactory<TSrc,TDst,TState> 作,並需以 CustomMappingFactoryAttributeAttribute 提供的 contractName裝飾 。 包含該類別的組合語言應該會在載回該類別的環境中註冊,使用 RegisterAssembly(Assembly, Boolean)。

stateInitAction
Action<TState>

初始化狀態物件的動作,也就是游標初始化前呼叫一次的動作。

contractName
String

合約名稱,ML.NET 用來載入模型。 若 null 指定為 ,所得變壓器將無法保存。

傳回

適用於