2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
// See the LICENSE file in the project root for more information.
4
4
5
- using Microsoft . ML . Data ;
6
5
using System ;
7
6
using System . Collections . Generic ;
8
7
using System . IO ;
9
8
using System . Linq ;
9
+ using Microsoft . Data . DataView ;
10
+ using Microsoft . ML ;
11
+ using Microsoft . ML . Data ;
12
+ using Microsoft . ML . Internal . Utilities ;
13
+ using Microsoft . ML . Model ;
14
+ using Microsoft . ML . Model . OnnxConverter ;
15
+ using Microsoft . ML . Model . Pfa ;
10
16
11
17
[ assembly: LoadableClass ( typeof ( RowToRowMapperTransform ) , null , typeof ( SignatureLoadDataTransform ) ,
12
18
"" , RowToRowMapperTransform . LoaderSignature ) ]
@@ -95,7 +101,7 @@ public RowToRowMapperTransform(IHostEnvironment env, IDataView input, IRowMapper
95
101
_mapperFactory = mapperFactory ;
96
102
_bindings = new ColumnBindings ( input . Schema , mapper . GetOutputColumns ( ) ) ;
97
103
}
98
- public static Schema GetOutputSchema ( Schema inputSchema , IRowMapper mapper )
104
+ public static DataViewSchema GetOutputSchema ( DataViewSchema inputSchema , IRowMapper mapper )
99
105
{
100
106
Contracts . CheckValue ( inputSchema , nameof ( inputSchema ) ) ;
101
107
Contracts . CheckValue ( mapper , nameof ( mapper ) ) ;
@@ -138,7 +144,7 @@ private protected override void SaveModel(ModelSaveContext ctx)
138
144
/// Produces the set of active columns for the data view (as a bool[] of length bindings.ColumnCount),
139
145
/// and the needed active input columns, given a predicate for the needed active output columns.
140
146
/// </summary>
141
- private bool [ ] GetActive ( Func < int , bool > predicate , out IEnumerable < Schema . Column > inputColumns )
147
+ private bool [ ] GetActive ( Func < int , bool > predicate , out IEnumerable < DataViewSchema . Column > inputColumns )
142
148
{
143
149
int n = _bindings . Schema . Count ;
144
150
var active = Utils . BuildArray ( n , predicate ) ;
@@ -180,20 +186,20 @@ private Func<int, bool> GetActiveOutputColumns(bool[] active)
180
186
return null ;
181
187
}
182
188
183
- protected override RowCursor GetRowCursorCore ( IEnumerable < Schema . Column > columnsNeeded , Random rand = null )
189
+ protected override DataViewRowCursor GetRowCursorCore ( IEnumerable < DataViewSchema . Column > columnsNeeded , Random rand = null )
184
190
{
185
191
var predicate = RowCursorUtils . FromColumnsToPredicate ( columnsNeeded , OutputSchema ) ;
186
- var active = GetActive ( predicate , out IEnumerable < Schema . Column > inputCols ) ;
192
+ var active = GetActive ( predicate , out IEnumerable < DataViewSchema . Column > inputCols ) ;
187
193
188
194
return new Cursor ( Host , Source . GetRowCursor ( inputCols , rand ) , this , active ) ;
189
195
}
190
196
191
- public override RowCursor [ ] GetRowCursorSet ( IEnumerable < Schema . Column > columnsNeeded , int n , Random rand = null )
197
+ public override DataViewRowCursor [ ] GetRowCursorSet ( IEnumerable < DataViewSchema . Column > columnsNeeded , int n , Random rand = null )
192
198
{
193
199
Host . CheckValueOrNull ( rand ) ;
194
200
195
201
var predicate = RowCursorUtils . FromColumnsToPredicate ( columnsNeeded , OutputSchema ) ;
196
- var active = GetActive ( predicate , out IEnumerable < Schema . Column > inputCols ) ;
202
+ var active = GetActive ( predicate , out IEnumerable < DataViewSchema . Column > inputCols ) ;
197
203
198
204
var inputs = Source . GetRowCursorSet ( inputCols , n , rand ) ;
199
205
Host . AssertNonEmpty ( inputs ) ;
@@ -231,7 +237,7 @@ void ISaveAsPfa.SaveAsPfa(BoundPfaContext ctx)
231
237
/// <summary>
232
238
/// Given a set of output columns, return the input columns that are needed to generate those output columns.
233
239
/// </summary>
234
- IEnumerable < Schema . Column > IRowToRowMapper . GetDependencies ( IEnumerable < Schema . Column > dependingColumns )
240
+ IEnumerable < DataViewSchema . Column > IRowToRowMapper . GetDependencies ( IEnumerable < DataViewSchema . Column > dependingColumns )
235
241
{
236
242
var predicate = RowCursorUtils . FromColumnsToPredicate ( dependingColumns , OutputSchema ) ;
237
243
GetActive ( predicate , out var inputColumns ) ;
@@ -240,7 +246,7 @@ void ISaveAsPfa.SaveAsPfa(BoundPfaContext ctx)
240
246
241
247
public DataViewSchema InputSchema => Source . Schema ;
242
248
243
- public Row GetRow ( Row input , Func < int , bool > active )
249
+ public DataViewRow GetRow ( DataViewRow input , Func < int , bool > active )
244
250
{
245
251
Host . CheckValue ( input , nameof ( input ) ) ;
246
252
Host . CheckValue ( active , nameof ( active ) ) ;
0 commit comments