1544 references to Assert
Microsoft.ML.Core (20)
Data\ModelLoading.cs (7)
93
env.
Assert
(ent.Stream.Position == 0);
103
env.
Assert
(ent.Stream.Position == 0);
163
env.
Assert
(fp == ctx.FpMin);
244
_ectx.
Assert
(Reader.BaseStream.Position == FpMin + Header.FpModel);
263
_ectx.
Assert
(Reader.BaseStream.Position == FpMin + Header.FpModel);
277
_ectx.
Assert
(Reader.BaseStream.Position == FpMin + Header.FpModel);
316
_ectx.
Assert
(ent.Stream.Position == 0);
Data\ModelSaveContext.cs (1)
250
_ectx.
Assert
((_ent == null) == !InRepository);
Data\ProgressReporter.cs (5)
381
_ectx.
Assert
(entry == null);
411
_ectx.
Assert
(entry == null);
416
_ectx.
Assert
(entry != null);
417
_ectx.
Assert
(kind == ProgressEvent.EventKind.Progress);
418
_ectx.
Assert
(!info.IsFinished);
Data\Repository.cs (5)
151
_ectx.
Assert
(!Disposed);
236
_ectx.
Assert
(!Disposed);
274
_ectx.
Assert
(!Disposed);
351
ExceptionContext.
Assert
(!Disposed);
382
ExceptionContext.
Assert
(!Disposed);
Data\ServerChannel.cs (2)
121
_chp.
Assert
((_toPublish == null) == (_onPublish == null));
132
_chp.
Assert
((_onPublish == null) == (_toPublish == null));
Microsoft.ML.Core.Tests (1)
UnitTests\TestEntryPoints.cs (1)
3176
Env.
Assert
(Utils.Size(xfNames) == Utils.Size(xfArgs));
Microsoft.ML.Data (726)
Commands\CrossValidationCommand.cs (4)
237
ch.
Assert
(perInstance.Length == 1);
478
host.
Assert
(0 <= fold && fold <= _numFolds);
500
ch.
Assert
(!testFilter.Complement);
509
ch.
Assert
(_applyTransformsToValidationData != null);
Commands\DataCommand.cs (1)
383
Host.
Assert
(!string.IsNullOrWhiteSpace(ImplOptions.InputModelFile));
Commands\ScoreCommand.cs (2)
157
ch.
Assert
(writer != null);
182
ch.
Assert
(outputAllColumns || maxScoreId > 0); // score set IDs are one-based
Commands\TrainCommand.cs (1)
279
ch.
Assert
(validData == null || trainer.Info.SupportsValidation);
Commands\TypeInfoCommand.cs (4)
108
ch.
Assert
(isIdentity);
124
ch.
Assert
(Utils.Size(dsts) >= 1);
125
ch.
Assert
(Utils.Size(srcs) >= 1);
144
ch.
Assert
(type.IsStandardScalar());
Data\DataViewUtils.cs (27)
120
host.
Assert
(cthd > 0);
373
ch.
Assert
(localCursor.Position < 0);
430
ch.
Assert
(count == 0 || localCursor.Batch > oldBatch);
512
ch.
Assert
(input.Schema == _schema);
513
ch.
Assert
(cthd >= 2);
514
ch.
Assert
(AllCacheable(_schema, input.IsColumnActive));
536
ch.
Assert
(0 <= activeToCol[c] && activeToCol[c] < _schema.Count);
537
ch.
Assert
(c == 0 || activeToCol[c - 1] < activeToCol[c]);
539
ch.
Assert
(input.IsColumnActive(column));
540
ch.
Assert
(column.Type.IsCacheable());
611
ch.
Assert
(remaining >= 0);
1037
Ch.
Assert
(colToActive.Length == schema.Count);
1038
Ch.
Assert
(activeToCol.Length + (int)ExtraIndex._Lim == pipes.Length);
1039
Ch.
Assert
(pipes.All(p => p != null));
1072
Ch.
Assert
(!_disposed);
1079
Ch.
Assert
(pipe.Remaining == _remaining);
1095
Ch.
Assert
(nextBatch.HasException || nextBatch.BatchId > Batch);
1096
Ch.
Assert
(nextBatch.HasException || nextBatch.Count > 0);
1102
Ch.
Assert
(!nextBatch.HasException);
1206
Ch.
Assert
(cursor.Position < 0);
1255
Ch.
Assert
(col < cursor.Schema.Count);
1256
Ch.
Assert
(cursor.IsColumnActive(Schema[col]));
1257
Ch.
Assert
(type.Equals(cursor.Schema[col].Type));
1271
Ch.
Assert
(!_disposed);
1280
Ch.
Assert
(_currentCursor.Batch > _batch);
1290
Ch.
Assert
(Position < 0 || stats.Batch > _batch);
1294
Ch.
Assert
(stats.Batch == _currentCursor.Batch);
Data\RowCursorUtils.cs (3)
520
_host.
Assert
(Enumerable.Range(0, row.Schema.Count).All(c => row.IsColumnActive(row.Schema[c])));
556
Ch.
Assert
(active.Length == parent.Schema.Count);
592
Ch.
Assert
(_parent._row.IsColumnActive(column));
Data\SlotCursor.cs (2)
135
Ch.
Assert
(_slotIndex >= 0);
141
Ch.
Assert
(_slotIndex < 0);
DataLoadSave\Binary\BinaryLoader.cs (47)
147
_ectx.
Assert
(0 <= index && index < parent._header.ColumnCount);
150
_ectx.
Assert
(metadataTocOffset == 0 || Header.HeaderSize <= metadataTocOffset);
152
_ectx.
Assert
(Header.HeaderSize <= lookupOffset);
166
_ectx.
Assert
(!IsGenerated);
194
_ectx.
Assert
(IsGenerated);
205
_ectx.
Assert
(IsGenerated);
219
_ectx.
Assert
(IsGenerated);
220
_ectx.
Assert
(typeof(T) == Type.RawType);
230
_ectx.
Assert
(!IsGenerated == (LookupOffset > 0));
273
_ectx.
Assert
(_maxDecompLen >= 0);
274
_ectx.
Assert
(_maxCompLen >= 0);
293
_ectx.
Assert
(0 <= _maxCompLen);
294
_ectx.
Assert
(0 <= _maxDecompLen);
388
_ectx.
Assert
((MetadataTocOffset == 0) == (_metadataToc == null));
389
_ectx.
Assert
((MetadataTocOffset == 0) == (_deadMetadataToc == null));
402
_ectx.
Assert
((MetadataTocOffset == 0) == (_metadataToc == null));
403
_ectx.
Assert
((MetadataTocOffset == 0) == (_deadMetadataToc == null));
416
_ectx.
Assert
(MetadataTocOffset == 0);
433
_ectx.
Assert
((_metadataTocEnd == 0) == (MetadataTocOffset == 0));
503
ectx.
Assert
(Enum.IsDefined(typeof(CompressionKind), compression));
510
ectx.
Assert
(valueType.IsGenericEx(typeof(VBuffer<>)));
512
ectx.
Assert
(args.Length == 1);
786
_host.
Assert
(_outputSchema.Count == Utils.Size(_aliveColumns));
874
ch.
Assert
(_outputSchema.Count == Utils.Size(_aliveColumns));
908
h.
Assert
(retVal == null);
946
_host.
Assert
(_threads >= 1);
951
_host.
Assert
(Utils.Size(unsavable) == 0);
984
h.
Assert
(noRows.GetRowCount() == 0);
1172
ch.
Assert
(poolSize >= 0);
1464
Ectx.
Assert
(0 <= columnIndex && columnIndex < Utils.Size(parent._actives));
1568
Ectx.
Assert
(entry.IsGenerated);
1572
Ectx.
Assert
(bufferSize > 0);
1607
Ectx.
Assert
(!_toRead.IsAddingCompleted);
1632
Ectx.
Assert
(_remaining >= 0);
1633
Ectx.
Assert
(_remaining == 0 || _curr != null);
1644
Ectx.
Assert
(_remaining > 0);
1772
Ectx.
Assert
(bufferSize > 0);
1776
Ectx.
Assert
(!entry.IsGenerated);
1778
Ectx.
Assert
(entry.Codec is IValueCodec<T>);
1779
Ectx.
Assert
(Enum.IsDefined(typeof(CompressionKind), entry.Compression));
1975
Ch.
Assert
(!_disposed);
2011
Ch.
Assert
(more == pipeMoved);
2090
Ch.
Assert
(pos / _rowsPerBlock < _blockShuffleOrder.Length);
2093
Ch.
Assert
(0 <= blockPos && blockPos < _parent.RowCount);
2177
ch.
Assert
(col.ColumnIndex == colCount); // *Every* column in the file should be here, even if dead.
2206
ch.
Assert
(deadMtoc == null && col.MetadataTocOffset == 0);
2221
ch.
Assert
(colCount == header.ColumnCount);
DataLoadSave\Binary\BinarySaver.cs (19)
219
_host.
Assert
(columns > 0);
220
_host.
Assert
(_deterministicBlockOrder == (waiter != null));
265
_host.
Assert
(0 <= col && col < schema.Count);
344
_host.
Assert
(metadataInfos.Count == offsets.Count - 1);
352
_host.
Assert
(typeof(T) == type.RawType);
375
_host.
Assert
(tmp);
388
_host.
Assert
(tmp);
407
cp.
Assert
(rowsPerBlock > 0);
429
ch.
Assert
(tmp);
451
ch.
Assert
(lookups.Count == block.BlockIndex);
458
ch.
Assert
(lookups[blockIndex].BlockOffset == 0);
476
ch.
Assert
(deadLookups[c] == 0);
487
ch.
Assert
(lookup.BlockOffset > 0);
581
ch.
Assert
(rowsPerBlock > 0);
659
ch.
Assert
(rowsPerBlock > 0);
692
_host.
Assert
(compressionTask != null || toCompress.IsCompleted);
722
_host.
Assert
(type.Equals(codec.Type));
733
_host.
Assert
(_maxRowsPerBlock.HasValue && _maxRowsPerBlock.Value > 0); // argument validation should have ensured this
904
_host.
Assert
(typeof(T) == codec.Type.RawType);
DataLoadSave\Database\DatabaseLoaderCursor.cs (3)
38
Ch.
Assert
(active == null || active.Length == parent._bindings.OutputSchema.Count);
52
Ch.
Assert
(_getters[i] != null);
181
Ch.
Assert
(colInfo.ColType.RawType == typeof(TValue));
DataLoadSave\LegacyCompositeDataLoader.cs (2)
309
h.
Assert
(!(loader is LegacyCompositeDataLoader));
489
host.
Assert
(tagData.Count == acceptedIds.Count);
DataLoadSave\Text\TextLoader.cs (14)
725
ch.
Assert
(0 <= inputSize && inputSize < SrcLim);
742
ch.
Assert
(min <= max);
782
ch.
Assert
(Utils.Size(col.Source) > 0);
809
ch.
Assert
(!seg.IsVariable);
813
ch.
Assert
(needInputSize && 0 < inputSize && inputSize < SrcLim);
817
ch.
Assert
(!seg.IsVariable);
822
ch.
Assert
(seg.IsVariable);
827
ch.
Assert
(!seg.IsVariable);
845
ch.
Assert
(0 <= isegOther && isegOther < segsOther.Length);
878
ch.
Assert
(min < lim);
1179
_host.
Assert
(Utils.Size(cols) > 0);
1353
ch.
Assert
(h.Loader == null || h.Loader is ICommandLineComponentFactory);
1518
_host.
Assert
((_flags & ~OptionFlags.All) == 0);
1520
_host.
Assert
(0 <= _inputSize && _inputSize < SrcLim);
DataLoadSave\Text\TextLoaderCursor.cs (8)
89
Ch.
Assert
(active == null || active.Length == parent._bindings.OutputSchema.Count);
92
Ch.
Assert
(srcNeeded >= 0);
93
Ch.
Assert
(cthd > 0);
118
Ch.
Assert
(v != null);
120
Ch.
Assert
(_getters[i] != null);
333
Ch.
Assert
(_rows.Count == 1);
339
Ch.
Assert
(batch.Exception == null);
343
Ch.
Assert
(info.Line > 0);
DataLoadSave\Text\TextLoaderParser.cs (2)
157
_ch.
Assert
(cref > 0);
165
_ch.
Assert
(n >= 0);
DataLoadSave\Transpose\TransposeLoader.cs (27)
246
Host.
Assert
(rowCountNull.HasValue);
273
Host.
Assert
(0 <= col && col < parent.Schema.Count);
308
Host.
Assert
(rowCountNull.HasValue);
476
_host.
Assert
(_schemaEntry.GetViewOrNull() == schemaView);
481
_host.
Assert
(_entries[c].GetViewOrNull() == null);
483
_host.
Assert
(HasRowData);
511
h.
Assert
(schemaView == null);
528
_host.
Assert
(_threads >= 0);
546
env.
Assert
(noRows.GetRowCount() == 0);
553
env.
Assert
(Enumerable.Range(0, schema.Count).All(c => saver.IsColumnSavable(schema[c].Type)));
681
Ch.
Assert
(cursor.Schema.Count == 1);
682
Ch.
Assert
(cursor.Schema[0].Type.RawType == typeof(VBuffer<T>));
683
Ch.
Assert
(cursor.Schema[0].Type is VectorDataViewType);
720
_host.
Assert
(0 <= col && col < _header.ColumnCount);
722
_host.
Assert
(!HasRowData);
733
_host.
Assert
(view.Schema.Count == 1);
736
_host.
Assert
(trans.Schema.Count == 1);
738
_host.
Assert
((trans as ITransposeDataView)?.GetSlotType(0).GetValueCount() == Schema[col].Type.GetValueCount());
768
Ch.
Assert
(!_parent.HasRowData);
796
Ch.
Assert
(0 <= col && col < Schema.Count);
797
Ch.
Assert
(_colToActivesIndex[col] >= 0);
799
Ch.
Assert
(((ITransposeDataView)_parent).GetSlotType(col).Size == _parent._header.RowCount);
814
Ch.
Assert
(typeof(T) == type.RawType);
823
Ch.
Assert
(buff.Length == 1);
834
Ch.
Assert
(type is VectorDataViewType);
835
Ch.
Assert
(typeof(T) == type.GetItemType().RawType);
861
Ch.
Assert
(cMore == more);
DataLoadSave\Transpose\TransposeSaver.cs (3)
106
ch.
Assert
(stream.CanSeek);
164
ch.
Assert
(offsets.Count == cols.Length + 2);
165
ch.
Assert
(offsets[offsets.Count - 1] == stream.Position);
DataView\AppendRowsDataView.cs (11)
75
_host.
Assert
(sources.Length >= 2);
258
Ch.
Assert
(0 <= _currentSourceIndex && _currentSourceIndex < Sources.Length);
259
Ch.
Assert
(_currentCursor != null);
320
Ch.
Assert
(Sources.Length == counts.Length);
324
Ch.
Assert
(counts[i] >= 0);
355
Ch.
Assert
(0 <= _currentSourceIndex && _currentSourceIndex < Sources.Length);
371
Ch.
Assert
(pos < _cursorSet.Length);
374
Ch.
Assert
(r);
421
_ectx.
Assert
(Utils.Size(counts) > 0);
427
context.
Assert
(count >= 0 && _totalLeft + count >= _totalLeft);
466
_ectx.
Assert
(_batchEnd > 0);
DataView\ArrayDataViewBuilder.cs (6)
214
_host.
Assert
(rowCount >= 0);
215
_host.
Assert
(builder._names.Count == builder._columns.Count);
270
Ch.
Assert
(view.Schema.Count >= 0);
344
Ch.
Assert
(Position < _view._rowCount);
350
Ch.
Assert
(IsGood);
351
Ch.
Assert
(0 <= Position && Position < _view._rowCount);
DataView\BatchDataViewMapperBase.cs (3)
122
Ch.
Assert
(getter != null);
156
Ch.
Assert
(_lastInBatchInLookAheadCursorDel());
161
Ch.
Assert
(good);
DataView\CacheDataView.cs (31)
135
env.
Assert
(ip == prefetch.Length || c <= prefetch[ip]);
161
env.
Assert
(ip == prefetch.Length || c < prefetch[ip]);
163
env.
Assert
(ip == prefetch.Length);
187
_host.
Assert
(-1 <= result && result < _subsetInput.Schema.Count);
236
_host.
Assert
(rc >= 0);
276
_host.
Assert
(n > 1);
306
_host.
Assert
(_rowCount >= 0);
476
Ch.
Assert
(Position >= 0);
481
Ch.
Assert
(Position == -1);
1175
Ch.
Assert
(_colToActivesIndex[c] == ic);
1219
Ch.
Assert
(0 <= col && col < _colToActivesIndex.Length);
1220
Ch.
Assert
(_colToActivesIndex[col] >= 0);
1226
Ch.
Assert
(0 <= col && col < _colToActivesIndex.Length);
1227
Ch.
Assert
(_colToActivesIndex[col] >= 0);
1228
Ch.
Assert
(Schema[col].Type.RawType == typeof(TValue));
1284
host.
Assert
(0 <= srcCol && srcCol < input.Schema.Count);
1285
host.
Assert
(input.IsColumnActive(input.Schema[srcCol]));
1293
host.
Assert
(type is PrimitiveDataViewType);
1351
Ctx.
Assert
(type is VectorDataViewType);
1360
Ctx.
Assert
(0 <= _rowCount && _rowCount < int.MaxValue);
1367
Ctx.
Assert
(_uniformLength == 0 || _uniformLength == _temp.Length);
1387
Ctx.
Assert
(0 <= idx);
1388
Ctx.
Assert
((idx + 1) < Utils.Size(_indexBoundaries));
1389
Ctx.
Assert
((idx + 1) < Utils.Size(_valueBoundaries));
1390
Ctx.
Assert
(_uniformLength > 0 || idx < Utils.Size(_lengths));
1392
Ctx.
Assert
(_indexBoundaries[idx + 1] - _indexBoundaries[idx] <= int.MaxValue);
1394
Ctx.
Assert
(_valueBoundaries[idx + 1] - _valueBoundaries[idx] <= int.MaxValue);
1396
Ctx.
Assert
(valueCount == indexCount || indexCount == 0);
1397
Ctx.
Assert
(0 <= indexCount && indexCount <= valueCount);
1399
Ctx.
Assert
(valueCount <= len);
1400
Ctx.
Assert
(valueCount == len || indexCount == valueCount);
DataView\DataViewConstructionUtils.cs (13)
223
Host.
Assert
(schema.Count == schemaDef.Columns.Length);
224
Host.
Assert
(schema.Count == peeks.Length);
243
Host.
Assert
(vectorType != null);
248
Host.
Assert
(vectorType.ItemType is TextDataViewType);
254
Host.
Assert
(Nullable.GetUnderlyingType(outputType.GetElementType()) == vectorType.ItemType.RawType);
256
Host.
Assert
(outputType.GetElementType() == vectorType.ItemType.RawType);
264
Host.
Assert
(outputType.IsGenericType);
265
Host.
Assert
(outputType.GetGenericTypeDefinition() == typeof(VBuffer<>));
266
Host.
Assert
(outputType.GetGenericArguments()[0] == vectorType.ItemType.RawType);
275
Host.
Assert
(colType is TextDataViewType);
281
Host.
Assert
(colType.RawType == Nullable.GetUnderlyingType(outputType));
283
Host.
Assert
(colType.RawType == outputType);
676
Ch.
Assert
(Position < _data.Count);
DataView\LambdaColumnMapper.cs (5)
111
Host.
Assert
(typeDst.RawType == typeof(T3));
113
Host.
Assert
(map2 != null || typeof(T2) == typeof(T3));
132
Host.
Assert
(vectorSize > 0);
150
Host.
Assert
(iinfo == 0);
158
Host.
Assert
(iinfo == 0);
DataView\LambdaFilter.cs (3)
90
Host.
Assert
(conv != null || typeof(T1) == typeof(T2));
91
Host.
Assert
(0 <= colSrc && colSrc < Source.Schema.Count);
167
Ch.
Assert
(typeof(T1) == typeof(T2));
DataView\RowToRowMapperTransform.cs (1)
404
Ch.
Assert
(getter != null);
DataView\Transposer.cs (36)
148
ch.
Assert
(Enumerable.Range(0, slicerSchema.Count).All(c => saver.IsColumnSavable(slicerSchema[c].Type)));
160
ch.
Assert
(min < lim);
186
ch.
Assert
(rowCount >= 0);
247
_host.
Assert
(0 <= tcol && tcol < _cols.Length);
248
_host.
Assert
(_cols[tcol].Index == col);
273
_host.
Assert
(elementType != null);
309
Ch.
Assert
(0 <= col && col < parent.Schema.Count);
327
Ch.
Assert
(0 <= _col && _col < _parent.Schema.Count);
344
Ch.
Assert
(0 <= col && col < parent.Schema.Count);
346
Ch.
Assert
(iinfo >= 0);
358
Ch.
Assert
(parent._splitLim[iinfo] - _col == 1);
361
Ch.
Assert
(_view.Schema[_col].Type is PrimitiveDataViewType);
362
Ch.
Assert
(_view.Schema[_col].Type.RawType == typeof(T));
395
Ch.
Assert
(len <= _len);
405
Ch.
Assert
(len == _len);
475
Ch.
Assert
(iinfo >= 0);
513
Ch.
Assert
(_slotCurr >= 0);
519
Ch.
Assert
(itemType.RawType == typeof(T));
521
Ch.
Assert
(vecLen > 0);
601
Ch.
Assert
(heap.Count == 0);
617
Ch.
Assert
(pair.Key > s);
626
Ch.
Assert
(rbuff.IsDense || rbuffIndices[ii] == s);
641
Ch.
Assert
(0 <= idx && idx < _len);
649
Ch.
Assert
(offset == _len);
670
Ch.
Assert
(_indices[s].Length == _len);
671
Ch.
Assert
(_values[s].Length == _len);
686
Ch.
Assert
(_slotCurr == _slotLim);
691
Ch.
Assert
(_slotLim > 0);
699
Ch.
Assert
(0 <= _slotCurr && _slotCurr < Utils.Size(_cbuff) && _cbuff[_slotCurr].Buffer.Length == _len);
757
_host.
Assert
(splitter.ColumnCount >= 1);
787
_host.
Assert
(outputColumnCount == _colToSplitIndex.Length);
813
_host.
Assert
(0 <= incol && incol < _incolToLim.Length);
826
_host.
Assert
(0 <= col && col < _colToSplitIndex.Length);
1274
Ch.
Assert
(Utils.Size(activeSplitters) == slicer._splitters.Length);
1375
ctx.
Assert
(genTypeArgs.Length == 1);
1445
_host.
Assert
(valueCount > 0);
DataView\TypedCursor.cs (14)
123
_host.
Assert
(_columns.Length == _columnIndices.Length);
343
Ch.
Assert
(n == parent._columns.Length);
344
Ch.
Assert
(n == parent._columnIndices.Length);
364
Ch.
Assert
(colType is VectorDataViewType);
368
Ch.
Assert
(colType.GetItemType() is TextDataViewType);
374
Ch.
Assert
(colType.GetItemType().RawType == Nullable.GetUnderlyingType(fieldType.GetElementType()));
376
Ch.
Assert
(colType.GetItemType().RawType == fieldType.GetElementType());
384
Ch.
Assert
(fieldType.IsGenericType);
385
Ch.
Assert
(fieldType.GetGenericTypeDefinition() == typeof(VBuffer<>));
386
Ch.
Assert
(fieldType.GetGenericArguments()[0] == vectorType.ItemType.RawType);
395
Ch.
Assert
(colType is TextDataViewType);
396
Ch.
Assert
(peek == null);
402
Ch.
Assert
(colType.RawType == Nullable.GetUnderlyingType(fieldType));
404
Ch.
Assert
(colType.RawType == fieldType);
DataView\ZipDataView.cs (1)
50
_host.
Assert
(Utils.Size(sources) > 1);
Dirty\ChooseColumnsByIndexTransform.cs (1)
287
Ch.
Assert
(active == null || active.Length == bindings.OutputSchema.Count);
EntryPoints\EntryPointNode.cs (16)
223
ectx.
Assert
(IsValidType(type));
233
_ectx.
Assert
(!IsValueSet);
234
_ectx.
Assert
(value == null || Type.IsAssignableFrom(value.GetType()));
543
ch.
Assert
(colFieldType == typeof(string));
545
ch.
Assert
(inputColName is string || inputColName is Optional<string>);
574
env.
Assert
(success);
601
env.
Assert
(success);
795
_host.
Assert
(CanStart());
803
_host.
Assert
(success);
806
_host.
Assert
(_inputBuilder.GetMissingValues().Length == 0);
826
_host.
Assert
(good);
854
_host.
Assert
(bindings.Skip(1).All(binding => binding.GetType().Equals(firstBinding.GetType())));
858
_host.
Assert
(bindings.Count == 1);
877
_host.
Assert
(false);
943
_host.
Assert
(success && variableBinding != null);
1013
_host.
Assert
(_nodes.Contains(node));
EntryPoints\InputBuilder.cs (6)
84
_ectx.
Assert
(fields.Count == attrs.Count);
456
ectx.
Assert
(false);
469
ectx.
Assert
(false);
476
ectx.
Assert
(false);
636
ectx.
Assert
(genericType == typeof(Nullable<>));
685
_ectx.
Assert
(fields.Count == attrs.Count);
EntryPoints\TransformModelImpl.cs (2)
231
_ectx.
Assert
(IsCompositeRowToRowMapper(_chain));
249
_ectx.
Assert
(IsCompositeRowToRowMapper(_chain));
Evaluators\AnomalyDetectionEvaluator.cs (10)
452
Host.
Assert
(topK > 0);
453
Host.
Assert
(nameIndex == -1 || nameIndex >= 0);
454
Host.
Assert
(k > 0);
480
Host.
Assert
(!_streaming && PassNum < 2 || PassNum < 1);
504
Host.
Assert
(!_streaming && PassNum < 2 || PassNum < 1);
505
Host.
Assert
(schema.Label.HasValue);
516
Host.
Assert
(_topExamples.Count == 0);
602
Host.
Assert
(resultDict.ContainsKey(MetricKinds.OverallMetrics));
609
Host.
Assert
(moved);
612
Host.
Assert
(!moved);
Evaluators\BinaryClassifierEvaluator.cs (35)
162
Host.
Assert
(prob == null || prob.Count == 1);
574
Host.
Assert
(Utils.Size(classNames) == 2);
575
Host.
Assert
(aucReservoirSize >= -1);
576
Host.
Assert
(prCount >= 0);
577
Host.
Assert
(auPrcReservoirSize >= 0);
578
Host.
Assert
(useRaw || 0 <= threshold && threshold <= 1);
622
Host.
Assert
(schema.Label.HasValue);
623
Host.
Assert
(PassNum < 1);
633
Host.
Assert
(prob == null || prob.Count == 1);
640
Host.
Assert
((schema.Weight != null) == Weighted);
679
Host.
Assert
((_weightGetter != null) == Weighted);
825
Host.
Assert
(resultDict.ContainsKey(MetricKinds.OverallMetrics));
833
Host.
Assert
(moved);
836
Host.
Assert
(!moved);
873
Host.
Assert
(resultDict.ContainsKey(MetricKinds.PrCurve));
875
Host.
Assert
(resultDict.ContainsKey(MetricKinds.OverallMetrics));
899
Host.
Assert
(moved);
902
Host.
Assert
(!moved);
919
Host.
Assert
(thresholdColumn != null);
920
Host.
Assert
(precisionColumn != null);
921
Host.
Assert
(recallColumn != null);
922
Host.
Assert
(fprColumn != null);
952
Host.
Assert
(resultDict.ContainsKey(MetricKinds.OverallMetrics));
960
Host.
Assert
(moved);
963
Host.
Assert
(!moved);
998
Host.
Assert
(resultDict.ContainsKey(MetricKinds.PrCurve));
1000
Host.
Assert
(resultDict.ContainsKey(MetricKinds.OverallMetrics));
1024
Host.
Assert
(moved);
1027
Host.
Assert
(!moved);
1144
Host.
Assert
(_useRaw);
1150
Host.
Assert
(LabelIndex >= 0);
1151
Host.
Assert
(ScoreIndex >= 0);
1152
Host.
Assert
(_probIndex >= 0 || _useRaw);
1274
Host.
Assert
(!string.IsNullOrEmpty(_probCol));
1398
ch.
Assert
(string.IsNullOrEmpty(weightedConf) == string.IsNullOrEmpty(weightedFold));
Evaluators\ClusteringEvaluator.cs (15)
82
Host.
Assert
(resultDict.ContainsKey(MetricKinds.OverallMetrics));
89
Host.
Assert
(moved);
92
Host.
Assert
(!moved);
116
Host.
Assert
(schema.Feature.HasValue);
130
Host.
Assert
(!_calculateDbi || schema.Feature != null);
137
Host.
Assert
(!_calculateDbi || schema.Feature?.Type.IsKnownSizeVector() == true);
140
Host.
Assert
(scoreType != null && scoreType.Size > 0);
410
Host.
Assert
(features.HasValue);
496
Host.
Assert
(schema.Feature.HasValue);
500
Host.
Assert
(score.Type.GetVectorSize() == _scoresArr.Length);
514
Host.
Assert
(PassNum == 1 && _calculateDbi);
543
Host.
Assert
(IsActive());
551
Host.
Assert
(!_calculateDbi || _featGetter != null);
555
Host.
Assert
(PassNum == 1 && _calculateDbi);
637
Host.
Assert
(_numClusters > 0);
Evaluators\EvaluatorBase.cs (1)
296
Host.
Assert
(PassNum < 1);
Evaluators\EvaluatorUtils.cs (9)
137
ectx.
Assert
(ReadOnlyMemoryUtils.EqualsStr(kind, tmp));
401
env.
Assert
(inputCol < input.Schema.Count);
443
env.
Assert
(inputCol < input.Schema.Count);
996
ch.
Assert
(Utils.Size(getters) == schema.Count);
997
ch.
Assert
(Utils.Size(vBufferGetters) == schema.Count);
1047
ch.
Assert
(metricNames.Count == metricCount);
1088
env.
Assert
(hasStrats == hasStratVals);
1299
env.
Assert
(vectorMetrics.Length > 0);
1394
host.
Assert
(type != null && type.IsKnownSize && type.ItemType is TextDataViewType);
Evaluators\Metrics\ConfusionMatrix.cs (3)
77
_host.
Assert
(precision.Length == confusionTableCounts.Length);
78
_host.
Assert
(recall.Length == confusionTableCounts.Length);
79
_host.
Assert
(labelNames.Count == confusionTableCounts.Length);
Evaluators\MulticlassClassificationEvaluator.cs (16)
91
Host.
Assert
(numClasses > 0);
112
Host.
Assert
(Utils.Size(score) == 1);
114
Host.
Assert
(numClasses > 0);
400
Host.
Assert
(outputTopKAcc == null || outputTopKAcc > 0);
401
Host.
Assert
(scoreVectorSize > 0);
402
Host.
Assert
(Utils.Size(classNames) == scoreVectorSize);
414
Host.
Assert
(PassNum < 1);
415
Host.
Assert
(schema.Label.HasValue);
418
Host.
Assert
(score.Type.GetVectorSize() == _scoresArr.Length);
563
Host.
Assert
(resultDict.ContainsKey(MetricKinds.OverallMetrics));
571
Host.
Assert
(moved);
574
Host.
Assert
(!moved);
689
Host.
Assert
(_numClasses > 0);
697
Host.
Assert
(ScoreIndex >= 0);
698
Host.
Assert
(LabelIndex >= 0);
942
ch.
Assert
(string.IsNullOrEmpty(weightedConf) == string.IsNullOrEmpty(weightedFold));
Evaluators\MultiOutputRegressionEvaluator.cs (7)
74
Host.
Assert
(vectorSize > 0);
292
Host.
Assert
(size > 0);
462
Host.
Assert
(LabelIndex >= 0);
463
Host.
Assert
(ScoreIndex >= 0);
674
ch.
Assert
(hasStrats == hasStratVals);
754
ch.
Assert
(metricVals.Length == labelCount);
765
ch.
Assert
(foundUnweighted && foundWeighted);
Evaluators\QuantileRegressionEvaluator.cs (7)
51
Host.
Assert
(quantiles.IsDense && quantiles.Length == scoreSize);
72
Host.
Assert
(scoreType != null && scoreType.Size > 0 && (scoreType.ItemType == NumberDataViewType.Single || scoreType.ItemType == NumberDataViewType.Double));
223
Host.
Assert
(size > 0);
224
Host.
Assert
(slotNames.Length == 0 || slotNames.Length == size);
338
Host.
Assert
(_scoreSize > 0);
382
Host.
Assert
(LabelIndex >= 0);
383
Host.
Assert
(ScoreIndex >= 0);
Evaluators\RankingEvaluator.cs (5)
265
Host.
Assert
(resultDict.ContainsKey(MetricKinds.OverallMetrics));
272
Host.
Assert
(moved);
275
Host.
Assert
(!moved);
440
Host.
Assert
(truncationLevel > 0);
741
Host.
Assert
(0 < _truncationLevel);
Evaluators\RegressionEvaluator.cs (5)
184
Host.
Assert
(resultDict.ContainsKey(MetricKinds.OverallMetrics));
191
Host.
Assert
(moved);
194
Host.
Assert
(!moved);
271
Host.
Assert
(LabelIndex >= 0);
272
Host.
Assert
(ScoreIndex >= 0);
Model\Pfa\BoundPfaContext.cs (4)
84
_host.
Assert
(_nameToVarName.Count == fields.Count);
85
_host.
Assert
(_nameToVarName.Count == fieldNames.Count);
168
_host.
Assert
(0 <= col && col < schema.Count);
245
_host.
Assert
(!Pfa.ContainsCell(cellName));
Model\Pfa\SavePfaCommand.cs (3)
143
Host.
Assert
(transforms.Count == 0 || transforms.Last.Value == end);
163
Host.
Assert
(scorePipe.Source == end);
183
Host.
Assert
(trans.CanSavePfa);
Prediction\Calibrator.cs (18)
219
Host.
Assert
(predictor is IPredictorProducing<float>);
350
Host.
Assert
(_mapper is ISingleCanSavePfa);
384
Host.
Assert
(_mapper is ISingleCanSaveOnnx);
484
Host.
Assert
(predictor is IPredictorWithFeatureWeights<float>);
561
Host.
Assert
(predictor is IPredictorWithFeatureWeights<float>);
1887
ch.
Assert
(stack.Count == 0 || di.Score >= top.MaxX);
1897
ch.
Assert
(stack.Count == 0 || top.MaxX < curr.MinX);
1981
_host.
Assert
(Utils.IsMonotonicallyIncreasing(mins));
1982
_host.
Assert
(Utils.IsMonotonicallyIncreasing(maxes));
1983
_host.
Assert
(Utils.IsMonotonicallyIncreasing(values));
1984
_host.
Assert
(values.Length == 0 || (0 <= values[0] && values[values.Length - 1] <= 1));
1985
_host.
Assert
(mins.Zip(maxes, (min, max) => min <= max).All(x => x));
2064
_host.
Assert
(Mins.Length == Maxes.Length);
2065
_host.
Assert
(Mins.Length == Values.Length);
2071
_host.
Assert
(Mins[i] <= Maxes[i]);
2072
_host.
Assert
(Mins[i] > maxPrev);
2073
_host.
Assert
(Values[i] > valuePrev || Values[i] == valuePrev && i == 0);
2115
_host.
Assert
(pos < p);
Prediction\CalibratorCatalog.cs (2)
104
Host.
Assert
(success);
318
Host.
Assert
(input.IsColumnActive(input.Schema[_scoreColIndex]));
Scorers\BinaryClassifierScorer.cs (8)
110
env.
Assert
(mapper is ISchemaBoundRowMapper);
111
env.
Assert
(trainSchema.Label.HasValue);
187
Host.
Assert
(Bindable is IBindableCanSaveOnnx);
188
Host.
Assert
(Bindings.InfoCount >= 2);
193
Host.
Assert
(delta == 1);
220
Host.
Assert
(predictedLabelCol.HasValue);
235
Host.
Assert
(output.Schema == Bindings.RowMapper.OutputSchema);
236
Host.
Assert
(output.IsColumnActive(output.Schema[Bindings.ScoreColumnIndex]));
Scorers\FeatureContributionCalculation.cs (3)
216
_env.
Assert
(0 <= index && index < slotNames.Length);
254
_env.
Assert
(sb.Length >= 2);
319
_env.
Assert
(schema.Feature.HasValue);
Scorers\GenericScorer.cs (6)
213
Host.
Assert
(Bindable is IBindableCanSavePfa);
217
Host.
Assert
(_bindings.DerivedColumnCount == 0);
228
Host.
Assert
(Bindable is IBindableCanSaveOnnx);
232
Host.
Assert
(_bindings.DerivedColumnCount == 0);
267
Host.
Assert
(_bindings.DerivedColumnCount == 0);
270
Host.
Assert
(output.Schema == _bindings.RowMapper.OutputSchema);
Scorers\MulticlassClassificationScorer.cs (5)
245
env.
Assert
(getter is ValueGetter<VBuffer<T>>);
490
env.
Assert
(mapper is ISchemaBoundRowMapper);
495
env.
Assert
(type is VectorDataViewType);
565
Host.
Assert
(output.Schema == Bindings.RowMapper.OutputSchema);
566
Host.
Assert
(output.IsColumnActive(output.Schema[Bindings.ScoreColumnIndex]));
Scorers\PredictedLabelScorerBase.cs (8)
339
Host.
Assert
(Bindable is IBindableCanSavePfa);
344
Host.
Assert
(delta == 1);
372
Host.
Assert
(Bindable is IBindableCanSaveOnnx);
378
Host.
Assert
(delta == 1);
406
Host.
Assert
(Bindings.DerivedColumnCount == 1);
409
Host.
Assert
(output.Schema == Bindings.RowMapper.OutputSchema);
410
Host.
Assert
(Bindings.InfoCount == output.Schema.Count + 1);
419
Host.
Assert
(output.IsColumnActive(output.Schema[Bindings.ScoreColumnIndex]));
Scorers\RowToRowScorerBase.cs (3)
247
Ch.
Assert
(active.Length == _bindings.ColumnCount);
253
Ch.
Assert
(_output.Schema == _bindings.RowMapper.OutputSchema);
300
Ch.
Assert
(getter != null);
Training\TrainerEstimatorBase.cs (1)
136
Host.
Assert
(LabelColumn.IsValid);
Training\TrainerUtils.cs (1)
413
_env.
Assert
(trainer is ITrainer);
Transforms\BindingsWrappedRowCursor.cs (1)
60
Ch.
Assert
(isSrc);
Transforms\BootstrapSamplingTransformer.cs (2)
149
Host.
Assert
(_poolSize >= 0);
236
Ch.
Assert
(_remaining >= 0);
Transforms\ColumnConcatenatingEstimator.cs (1)
77
_host.
Assert
(col.IsValid);
Transforms\ColumnCopying.cs (1)
216
Host.
Assert
(0 <= iinfo && iinfo < _columns.Length);
Transforms\ColumnSelecting.cs (1)
545
_host.
Assert
(0 <= outputIndex && outputIndex < OutputToInputMap.Length);
Transforms\GenerateNumberTransform.cs (3)
443
Ch.
Assert
(originFn != null);
462
Ch.
Assert
(lastCounter <= Input.Position);
475
Ch.
Assert
(!_bindings.UseCounter[iinfo]);
Transforms\Hashing.cs (15)
236
Host.
Assert
(types[iinfo].GetItemType().GetKeyCount() > 0);
238
Host.
Assert
(disposer == null);
253
Host.
Assert
(_keyValues[invertIinfos[i]].Length == types[invertIinfos[i]].GetItemType().GetKeyCountAsInt32(Host));
264
Host.
Assert
(0 <= iinfo && iinfo < _columns.Length);
311
Host.
Assert
(_columns.Length == ColumnPairs.Length);
352
Host.
Assert
(HashingEstimator.IsColumnTypeValid(srcType));
369
Host.
Assert
(srcType.RawType == typeof(byte));
398
Host.
Assert
(srcType.RawType == typeof(bool));
404
Host.
Assert
(HashingEstimator.IsColumnTypeValid(srcType.ItemType));
416
Host.
Assert
(rawType == typeof(ulong));
445
Host.
Assert
(srcType.ItemType == TextDataViewType.Instance);
452
Host.
Assert
(srcType.ItemType.RawType == typeof(T));
466
Host.
Assert
(HashingEstimator.IsColumnTypeValid(srcType));
481
Host.
Assert
(rawType == typeof(byte));
510
Host.
Assert
(rawType == typeof(bool));
Transforms\InvertHashUtils.cs (3)
394
ch.
Assert
(result);
396
ch.
Assert
(vectorType.Size == 0);
397
ch.
Assert
(vectorType.ItemType == TextDataViewType.Instance);
Transforms\KeyToValue.cs (12)
215
Host.
Assert
(0 <= iinfo && iinfo < _types.Length);
250
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
255
Host.
Assert
(keyItemType.RawType == typeof(TKey));
256
Host.
Assert
(valItemType.RawType == typeof(TValue));
294
Parent.Host.
Assert
(0 <= iinfo && iinfo < Parent._types.Length);
319
Parent.Host.
Assert
(values.IsDense);
320
Parent.Host.
Assert
(typeKey.RawType == typeof(TKey));
321
Parent.Host.
Assert
(TypeOutput.RawType == typeof(TValue));
425
Parent.Host.
Assert
(islot < srcCount);
428
Parent.Host.
Assert
(slot < nextExplicitSlot);
432
Parent.Host.
Assert
(slot < nextExplicitSlot);
447
Parent.Host.
Assert
(islotSrc < srcCount);
Transforms\KeyToVector.cs (31)
155
Host.
Assert
(_columns.Length == ColumnPairs.Length);
295
Host.
Assert
(colIndex >= 0);
366
Host.
Assert
(0 <= iinfo && iinfo < _infos.Length);
368
Host.
Assert
(typeSrc != null && typeSrc.IsKnownSize);
372
Host.
Assert
(typeSrc.Size > 1);
390
Host.
Assert
(slotLim == (long)typeSrc.Size * keyCount);
421
Host.
Assert
(slot == slotLim);
428
Host.
Assert
(0 <= iinfo && iinfo < _infos.Length);
433
Host.
Assert
(valueCount > 0);
452
Host.
Assert
(0 <= iinfo && iinfo < _infos.Length);
471
Host.
Assert
(keyTypeSrc != null);
473
Host.
Assert
(size == _types[iinfo].Size);
474
Host.
Assert
(size > 0);
476
Host.
Assert
(srcCol >= 0);
505
Host.
Assert
(srcVectorType != null);
508
Host.
Assert
(keyTypeSrc != null);
509
Host.
Assert
(_parent._columns[iinfo].OutputCountVector);
511
Host.
Assert
(size == _types[iinfo].Size);
512
Host.
Assert
(size > 0);
515
Host.
Assert
(cv >= 0);
517
Host.
Assert
(srcCol >= 0);
551
Host.
Assert
(srcVectorType != null);
554
Host.
Assert
(keyTypeSrc != null);
555
Host.
Assert
(!_parent._columns[iinfo].OutputCountVector);
558
Host.
Assert
(size > 0);
561
Host.
Assert
(cv >= 0);
562
Host.
Assert
(_types[iinfo].Size == size * cv);
582
Host.
Assert
(lenSrc == cntSrc);
585
Host.
Assert
(count < cntSrc);
598
Host.
Assert
(count < cntSrc);
671
Host.
Assert
(keyCount > 0);
Transforms\LabelConvertTransform.cs (2)
185
Host.
Assert
(0 <= iinfo && iinfo < Infos.Length);
198
Host.
Assert
(0 <= iinfo && iinfo < Infos.Length);
Transforms\LabelIndicatorTransform.cs (5)
138
Host.
Assert
(Infos.Length == Utils.Size(options.Columns));
163
Host.
Assert
(0 <= iinfo && iinfo < Infos.Length);
172
ch.
Assert
(0 <= iinfo && iinfo < Infos.Length);
183
ch.
Assert
(0 <= iinfo && iinfo < Infos.Length);
187
ch.
Assert
(TestIsMulticlassLabel(info.TypeSrc) == null);
Transforms\NAFilter.cs (2)
180
Host.
Assert
(_infos.Length > 0);
420
Ch.
Assert
(IsColumnActive(Schema[col]));
Transforms\NormalizeColumn.cs (9)
486
Host.
Assert
(indicesNonZeroOffset == null || offset != null);
487
Host.
Assert
(Offset == null || Offset.Length == Scale.Length);
608
Host.
Assert
(mean.Length == stddev.Length);
744
Host.
Assert
(Rem >= 0);
779
Host.
Assert
(Rem >= 0);
813
Host.
Assert
(type is KeyDataViewType || type is NumberDataViewType);
817
Host.
Assert
(type.GetKeyCountAsInt32(Host) > 0);
860
Host.
Assert
(Rem >= 0);
917
Host.
Assert
(valueCol.Type.IsKnownSizeVector());
Transforms\NormalizeColumnDbl.cs (11)
678
host.
Assert
(scales.Length == cfeat);
679
host.
Assert
(offsets == null || offsets.Length == cfeat);
680
host.
Assert
(Utils.Size(nz) == 0 || offsets != null);
743
host.
Assert
(scales.Length == cfeat);
744
host.
Assert
(offsets == null || offsets.Length == cfeat);
745
host.
Assert
(Utils.Size(nz) == 0 || offsets != null);
1170
Host.
Assert
(0 <= _offset && _offset <= 1);
1250
Host.
Assert
(0 <= _offset[i] && _offset[i] <= 1);
1627
Host.
Assert
((lim == 0) == (cv == 1));
1812
Host.
Assert
((lim == 0) == (cv == 1));
1937
Host.
Assert
(0 <= values.Length && values.Length <= size);
Transforms\NormalizeColumnSng.cs (11)
836
host.
Assert
(scales.Length == cfeat);
837
host.
Assert
(offsets == null || offsets.Length == cfeat);
838
host.
Assert
(Utils.Size(nz) == 0 || offsets != null);
900
host.
Assert
(scales.Length == cfeat);
901
host.
Assert
(offsets == null || offsets.Length == cfeat);
902
host.
Assert
(Utils.Size(nz) == 0 || offsets != null);
1331
Host.
Assert
(0 <= _offset && _offset <= 1);
1411
Host.
Assert
(0 <= _offset[i] && _offset[i] <= 1);
1790
Host.
Assert
((lim == 0) == (cv == 1));
1975
Host.
Assert
((lim == 0) == (cv == 1));
2101
Host.
Assert
(0 <= count && count <= size);
Transforms\Normalizer.cs (2)
588
env.
Assert
(!(srcTypes[i] is VectorDataViewType vectorType) || vectorType.IsKnownSize);
589
env.
Assert
(functionBuilders[i] != null);
Transforms\PerGroupTransformBase.cs (3)
305
Ch.
Assert
(getter != null);
337
Ch.
Assert
(good);
339
Ch.
Assert
(_groupCursor.Position >= 0);
Transforms\RangeFilter.cs (11)
193
Host.
Assert
(_min < _max);
245
Host.
Assert
(_type is KeyDataViewType);
357
Ch.
Assert
(Parent._type == NumberDataViewType.Single);
369
Ch.
Assert
(Parent._type == NumberDataViewType.Single);
375
Ch.
Assert
(Parent._type == NumberDataViewType.Single);
390
Ch.
Assert
(Parent._type == NumberDataViewType.Double);
402
Ch.
Assert
(Parent._type == NumberDataViewType.Double);
408
Ch.
Assert
(Parent._type == NumberDataViewType.Double);
425
Ch.
Assert
(Parent._type.GetKeyCount() > 0);
440
Ch.
Assert
(Parent._type is KeyDataViewType);
446
Ch.
Assert
(Parent._type is KeyDataViewType);
Transforms\RowShufflingTransformer.cs (17)
508
Ch.
Assert
(_blockSize > 0);
509
Ch.
Assert
(_bufferDepth > 0);
510
Ch.
Assert
(poolRows > 0);
582
Ch.
Assert
(requested >= _blockSize);
586
Ch.
Assert
(0 <= circularIndex && circularIndex < _pipeIndices.Length);
590
Ch.
Assert
(0 <= pipeIndex && pipeIndex < _pipeIndices.Length);
618
Ch.
Assert
(_liveCount > 0);
619
Ch.
Assert
(_deadCount < _blockSize || _doneConsuming);
620
Ch.
Assert
(0 <= _circularIndex && _circularIndex < _pipeIndices.Length);
672
Ch.
Assert
((_colToActivesIndex[column.Index] >= 0) == _input.IsColumnActive(column));
678
Ch.
Assert
(0 <= col && col < _colToActivesIndex.Length);
679
Ch.
Assert
(_colToActivesIndex[col] >= 0);
685
Ch.
Assert
(0 <= col && col < _colToActivesIndex.Length);
686
Ch.
Assert
(_colToActivesIndex[col] >= 0);
687
Ch.
Assert
(Schema[col].Type.RawType == typeof(TValue));
694
Ch.
Assert
(pipe is ShufflePipe<TValue>);
699
Ch.
Assert
(_pipeIndex == _pipeIndices[_circularIndex]);
Transforms\SkipTakeFilter.cs (6)
91
Host.
Assert
(skip >= 0);
92
Host.
Assert
(take >= 0);
178
Host.
Assert
(_skip >= 0);
180
Host.
Assert
(_take >= 0);
241
Ch.
Assert
(skip >= 0);
242
Ch.
Assert
(take >= 0);
Transforms\SlotsDroppingTransformer.cs (21)
302
Host.
Assert
(AreRangesValid(SlotsMin, SlotsMax));
342
Host.
Assert
(AreRangesValid(SlotsMin, SlotsMax));
345
Host.
Assert
(SlotsMin[i].Length == SlotsMax[i].Length);
525
Host.
Assert
(slotsMin.Length == slotsMax.Length);
526
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
542
Host.
Assert
(vectorType.IsKnownSize);
552
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
570
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
571
Host.
Assert
(slotsMax != null && slotsMin != null);
572
Host.
Assert
(slotsMax.Length == slotsMin.Length);
722
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
741
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
742
Host.
Assert
(!(_srcTypes[iinfo] is VectorDataViewType));
743
Host.
Assert
(_suppressed[iinfo]);
762
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
764
Host.
Assert
(_suppressed[iinfo]);
783
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
785
Host.
Assert
(!_suppressed[iinfo]);
810
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
812
Host.
Assert
(input.IsColumnActive(src));
833
Host.
Assert
(colIndex >= 0);
Transforms\TransformBase.cs (14)
576
Host.
Assert
(((ICanSavePfa)this).CanSavePfa);
606
Host.
Assert
(((ICanSaveOnnx)this).CanSaveOnnx(ctx));
642
Host.
Assert
(0 <= iinfo && iinfo < _bindings.InfoCount);
643
Host.
Assert
(Infos[iinfo] == info);
645
Host.
Assert
(((ICanSavePfa)this).CanSavePfa);
662
Host.
Assert
(0 <= iinfo && iinfo < Infos.Length);
670
Host.
Assert
(0 <= iinfo && iinfo < Infos.Length);
682
Host.
Assert
(0 <= iinfo && iinfo < Infos.Length);
697
Host.
Assert
(0 <= iinfo && iinfo < Infos.Length);
699
Host.
Assert
(input.IsColumnActive(input.Schema[src]));
773
Host.
Assert
(0 <= col && col < _bindings.ColumnCount);
806
Host.
Assert
(false);
857
Ch.
Assert
(active == null || active.Length == parent._bindings.ColumnCount);
907
Ch.
Assert
(originFn != null);
Transforms\TypeConverting.cs (3)
222
Host.
Assert
((InternalDataKind)(byte)_columns[i].OutputKind.ToInternalDataKind() == _columns[i].OutputKind.ToInternalDataKind());
371
ectx.
Assert
(KeyDataViewType.IsValidDataType(key.RawType));
416
ectx.
Assert
(Enum.IsDefined(typeof(InternalDataKind), kind));
Transforms\ValueMapping.cs (4)
684
env.
Assert
(loader.Schema.TryGetColumnIndex(keyColumnName, out int keyColumnIndex));
685
env.
Assert
(loader.Schema.TryGetColumnIndex(valueColumnName, out int valueColumnIndex));
749
ectx.
Assert
(rdr.BaseStream.CanSeek);
1051
Host.
Assert
(0 <= iinfo && iinfo < _columns.Length);
Transforms\ValueToKeyMappingTransformer.cs (14)
192
Host.
Assert
(_codecFactory != null);
261
ch.
Assert
(_unboundMaps.Length == columns.Length);
417
ch.
Assert
(isBinary != isTranspose);
424
ch.
Assert
(isTranspose);
460
ch.
Assert
(keyData.Schema.Count == 1);
579
ch.
Assert
((Utils.Size(toTrain) == 0) == (trainsNeeded == 0));
580
ch.
Assert
(Utils.Size(toTrain) <= trainsNeeded);
604
ch.
Assert
(itrainer == trainer.Length);
636
ch.
Assert
(termMap[iinfo] == null);
645
ch.
Assert
(termMap.All(tm => tm != null));
646
ch.
Assert
(termMap.Zip(infos, (tm, info) => tm.ItemType.Equals(info.TypeSrc.GetItemType())).All(x => x));
661
Host.
Assert
(_unboundMaps.Length == _textMetadata.Length);
662
Host.
Assert
(_textMetadata.Length == ColumnPairs.Length);
746
Host.
Assert
(colIndex >= 0);
Transforms\ValueToKeyMappingTransformerImpl.cs (26)
454
env.
Assert
(0 <= iinfo && iinfo < infos.Length);
538
ectx.
Assert
(false);
549
ectx.
Assert
(codec is IValueCodec<T>);
550
ectx.
Assert
(codec.Type is PrimitiveDataViewType);
551
ectx.
Assert
(count >= 0);
566
ectx.
Assert
(0 <= index && index <= i);
627
host.
Assert
(_pool.Count >= 0);
634
host.
Assert
(nstr.Id == id);
704
host.
Assert
(codec.Type.Equals(ItemType));
705
host.
Assert
(codec.Type is PrimitiveDataViewType);
827
_host.
Assert
(0 <= iinfo && iinfo < infos.Length);
829
_host.
Assert
(info.TypeSrc.GetItemType().Equals(map.ItemType));
839
host.
Assert
(0 <= iinfo && iinfo < infos.Length);
841
host.
Assert
(info.TypeSrc.GetItemType().Equals(map.ItemType));
912
_host.
Assert
(input.IsColumnActive(inputColumn));
933
_host.
Assert
(input.IsColumnActive(inputColumn));
1021
_host.
Assert
(islot < values.Length);
1029
_host.
Assert
(slot < nextExplicitSlot);
1089
_host.
Assert
(TypedMap.ItemType is KeyDataViewType);
1110
_host.
Assert
(srcMetaType.RawType == typeof(TMeta));
1128
_host.
Assert
(srcMeta.Length == srcType.GetCountAsInt32(_host));
1139
_host.
Assert
(0 < convKeyVal && convKeyVal <= srcMeta.Length);
1156
_host.
Assert
(dst.Length == keyCount);
1166
_host.
Assert
(dst.Length == keyCount);
1191
_host.
Assert
(srcMetaType.RawType == typeof(TMeta));
1223
_host.
Assert
(0 < convKeyVal && convKeyVal <= srcMeta.Length);
Utilities\ModelFileUtils.cs (2)
81
env.
Assert
(ent.Stream.Position == 0);
197
env.
Assert
(ent.Stream.Position == 0);
Microsoft.ML.Ensemble (23)
EntryPoints\CreateEnsemble.cs (2)
110
env.
Assert
(i == 0);
121
ch.
Assert
(transformedDataZipEntryNames == null);
OutputCombiners\BaseMultiAverager.cs (1)
28
Host.
Assert
(weights == null || Utils.Size(weights) == Utils.Size(src));
OutputCombiners\BaseStacking.cs (1)
78
Host.
Assert
(Meta != null);
OutputCombiners\Median.cs (1)
84
_host.
Assert
(weights == null || Utils.Size(weights) == Utils.Size(src));
OutputCombiners\MultiMedian.cs (1)
75
Host.
Assert
(weights == null || Utils.Size(weights) == Utils.Size(src));
OutputCombiners\MultiVoting.cs (2)
43
Host.
Assert
(!Normalize);
75
Host.
Assert
(weights == null || Utils.Size(weights) == Utils.Size(src));
OutputCombiners\MultiWeightedAverage.cs (1)
87
Host.
Assert
(Enum.IsDefined(typeof(MultiWeightageKind), _weightageKind));
OutputCombiners\Voting.cs (1)
79
_host.
Assert
(weights == null || Utils.Size(weights) == Utils.Size(src));
PipelineEnsemble.cs (6)
164
Parent.Host.
Assert
(0 <= i && i < Mappers.Length);
176
Parent.Host.
Assert
(0 <= i && i < Mappers.Length);
301
Host.
Assert
(_scoreColumnKind == AnnotationUtils.Const.ScoreColumnKind.BinaryClassification);
308
Host.
Assert
(_scoreColumnKind == AnnotationUtils.Const.ScoreColumnKind.BinaryClassification);
620
env.
Assert
(!(labelType is KeyDataViewType));
648
env.
Assert
(keyValuesType.ItemType.RawType == typeof(T));
Selector\SubModelSelector\BestDiverseSelectorMulticlass.cs (2)
45
Host.
Assert
(models.Count > 1);
46
Host.
Assert
(predictions.Count == models.Count);
Selector\SubModelSelector\BestPerformanceRegressionSelector.cs (1)
44
Host.
Assert
(!string.IsNullOrEmpty(_metricName));
Selector\SubModelSelector\BestPerformanceSelector.cs (1)
44
Host.
Assert
(!string.IsNullOrEmpty(_metricName));
Selector\SubModelSelector\BestPerformanceSelectorMulticlass.cs (1)
44
Host.
Assert
(!string.IsNullOrEmpty(_metricName));
Trainer\EnsembleTrainerBase.cs (1)
168
ch.
Assert
(batchModels[(int)index] == null);
Trainer\Multiclass\EnsembleMulticlassModelParameters.cs (1)
123
Host.
Assert
(_mappers[i].OutputType.GetVectorSize() > 0);
Microsoft.ML.EntryPoints (6)
CrossValidationMacro.cs (1)
382
env.
Assert
(Utils.Size(perInst) == 1);
JsonUtils\JsonManifestUtils.cs (4)
388
ectx.
Assert
(false);
467
ectx.
Assert
(componentInfo.ArgumentType == type);
479
ectx.
Assert
(false);
496
ectx.
Assert
(!fieldInfo.IsStatic && !fieldInfo.IsInitOnly && !fieldInfo.IsLiteral);
OneVersusAllMacro.cs (1)
146
env.
Assert
(input.Nodes.Count > 0);
Microsoft.ML.FastTree (80)
BoostingFastTree.cs (3)
128
ch.
Assert
(validationResult.FinalValue >= 0);
132
ch.
Assert
(trainingResult.FinalValue >= 0);
142
ch.
Assert
(earlyStoppingRule != null);
FastTree.cs (48)
205
Host.
Assert
(data.Schema.Feature.HasValue);
686
ch.
Assert
(Ensemble.Trees.Last() == tree);
943
Host.
Assert
(Utils.Size(binUpperBounds) == NumFeatures);
944
Host.
Assert
(binUpperBounds.All(b => b != null));
961
host.
Assert
(maxBins > 0);
1027
ch.
Assert
(0 <= features.Min() && features.Max() < NumFeatures);
1028
ch.
Assert
(features.Count > 0);
1073
ch.
Assert
(min <= fi && fi < lim);
1075
ch.
Assert
(subfeature >= 0);
1082
ch.
Assert
(bub.Length > 1);
1084
ch.
Assert
(0 < bin && bin < bub.Length); // If 0, should not have been considered "on", so what the heck?
1111
ch.
Assert
(0 <= features.Min() && features.Max() < NumFeatures);
1112
ch.
Assert
(features.Count > 1);
1148
ch.
Assert
(min <= fi && fi < lim);
1150
ch.
Assert
(subfeature >= 0);
1156
ch.
Assert
(bub.Length == 2);
1193
ch.
Assert
(Utils.Size(binUpperBounds) > 0);
1195
ch.
Assert
(binnedValues.Length == values.Length);
1329
Host.
Assert
(examples.Schema.Feature.HasValue);
1368
Host.
Assert
(1 <= toTranspose.Count && toTranspose.Count <= 4);
1413
Host.
Assert
(iFeature < features.Length);
1414
Host.
Assert
(features[iFeature] == null);
1416
Host.
Assert
(temp.Length == numExamples);
1422
ch.
Assert
(maxBins > 0);
1444
ch.
Assert
(slotDropper.DstLength < temp.Length);
1634
Host.
Assert
(features.All(f => f != null));
1846
ch.
Assert
(pos >= 0);
1849
Host.
Assert
(hasGroup || cursor.Group == groupPrev);
1947
ch.
Assert
(Utils.Size(features) > 1);
1995
ch.
Assert
(kvp.Key >= last);
1996
ch.
Assert
(kvp.Value > 0);
2003
ch.
Assert
(kvp.Key - last <= Byte.MaxValue);
2008
ch.
Assert
(kvp.Key > last || values.Count == 1 || values[values.Count - 1] > values[values.Count - 2]);
2055
ch.
Assert
(iFeature <= NumFeatures); // Some could have been filtered.
2056
ch.
Assert
(iFeature == FeatureMap.Length);
2079
ch.
Assert
(Utils.Size(bup) > 0);
2213
ch.
Assert
(pending.Count > 0);
2247
ch.
Assert
(0 < countBins && countBins <= Utils.ArrayMaxSize);
2248
ch.
Assert
(limMade < iFeature);
2249
ch.
Assert
(pending.Count > 0);
2298
ch.
Assert
(limMade < iFeature);
2299
ch.
Assert
(canBeOneHot);
2322
ch.
Assert
(values.CountIndicesGT(NumExamples, firstBin) == localHotRows);
2328
ch.
Assert
(limMade < iFeature);
2329
ch.
Assert
(countHotRows < hotNThreshold);
2330
ch.
Assert
(!canBeOneHot);
2907
Host.
Assert
(NumFeatures >= 0);
3141
Host.
Assert
(pair.Value is double);
FastTreeRanking.cs (1)
223
Host.
Assert
(FastTreeTrainerOptions.BaggingSize > 0);
GamModelParameters.cs (7)
171
Host.
Assert
(NumberOfShapeFunctions >= 0);
173
Host.
Assert
(_numInputFeatures >= 0);
183
Host.
Assert
(_binUpperBounds[i].Length == _binEffects[i].Length);
491
Host.
Assert
(internalNodeId == 0);
506
Host.
Assert
(lower == upper + 1);
675
ch.
Assert
(_scores.Length == _labels.Length);
754
ch.
Assert
(_saveVersion <= _version);
GamTrainer.cs (2)
264
Host.
Assert
(FeatureMap == null || FeatureMap.Length == TrainSet.NumFeatures);
270
Host.
Assert
(data.Schema.Feature.HasValue);
SumupPerformanceCommand.cs (5)
130
ch.
Assert
(FloatUtils.IsFinite(denom) && denom < 0);
147
ch.
Assert
(remaining == 0);
214
_host.
Assert
(0 < sparsity && sparsity < 1);
232
_host.
Assert
(0 <= sparsity && sparsity <= 1);
245
_host.
Assert
(Utils.IsIncreasing(0, data.DocIndices, count, _len));
TreeEnsemble\TreeEnsembleCombiner.cs (1)
114
_host.
Assert
(false);
TreeEnsembleFeaturizer.cs (13)
110
ectx.
Assert
(schema.Feature.HasValue);
249
_ectx.
Assert
(ensemble.TrainedEnsemble.NumTrees > 0);
282
_ectx.
Assert
(_input.Position >= 0);
283
_ectx.
Assert
(_cachedPosition == _input.Position);
308
_ectx.
Assert
(_input.Position >= 0);
309
_ectx.
Assert
(_cachedPosition == _input.Position);
327
_ectx.
Assert
(0 <= node && node < numNodes);
346
_ectx.
Assert
(Utils.Size(_leafIds) == _numTrees);
347
_ectx.
Assert
(Utils.Size(_pathIds) == _numTrees);
498
_host.
Assert
(i == _totalLeafCount);
518
_host.
Assert
(i == totalNodeCount);
716
ch.
Assert
(data.Schema.Feature.HasValue);
717
ch.
Assert
(predictor == predictor2);
Microsoft.ML.ImageAnalytics (1)
VectorToImageTransform.cs (1)
328
Host.
Assert
(0 <= iinfo && iinfo < _parent._columns.Length);
Microsoft.ML.KMeansClustering (14)
KMeansModelParameters.cs (2)
167
Host.
Assert
(distances.Length >= _k);
185
Host.
Assert
(_dimensionality == _centroids[i].Length);
KMeansPlusPlusTrainer.cs (12)
404
ch.
Assert
(FloatUtils.IsFinite(probabilityWeight));
862
ch.
Assert
(clusterCount - clusterPrevCount <= numSamplesPerRound);
903
ch.
Assert
(clusterCount - clusterPrevCount <= numSamplesPerRound);
907
ch.
Assert
(clusterCount == clusters.Length);
926
ch.
Assert
(bestCluster == debugBestCluster);
956
ch.
Assert
(totalWeights[i] == debugTotalWeights[i]);
958
ch.
Assert
(totalWeights.Length == clusters.Length);
1275
ch.
Assert
(k > 0);
1276
ch.
Assert
(totalTrainingInstances > 0);
1602
host.
Assert
(numSamples > 0);
1603
host.
Assert
(numThreads > 0);
1653
host.
Assert
(finalHeap == null);
Microsoft.ML.LightGbm (15)
LightGbmMulticlassTrainer.cs (2)
337
ch.
Assert
(PredictionKind == PredictionKind.MulticlassClassification);
338
ch.
Assert
(_numberOfClassesIncludingNan > 1);
LightGbmTrainerBase.cs (12)
1030
ch.
Assert
(dataset.GetNumRows() == numRow);
1031
ch.
Assert
(dataset.GetNumCols() == catMetaData.NumCol);
1057
ch.
Assert
(totalRowCount < numRow);
1063
ch.
Assert
(numElem == curRowCount * catMetaData.NumCol);
1071
ch.
Assert
(totalRowCount == numRow);
1074
ch.
Assert
(numElem == curRowCount * catMetaData.NumCol);
1093
ch.
Assert
(totalRowCount < numRow);
1099
ch.
Assert
(curRowCount > 0);
1117
ch.
Assert
(totalRowCount == numRow);
1135
ch.
Assert
(features.Length >= numElem + catMetaData.NumCol);
1177
ch.
Assert
(indices.Length >= numElem + numValue);
1178
ch.
Assert
(features.Length >= numElem + numValue);
WrappedLightGbmTraining.cs (1)
47
ch.
Assert
(parameters.ContainsKey("metric"));
Microsoft.ML.Maml (5)
HelpCommand.cs (5)
155
_env.
Assert
(signature.BaseType == typeof(MulticastDelegate));
205
_env.
Assert
(signature.BaseType == typeof(MulticastDelegate));
228
_env.
Assert
(loadName == loadNames[0]);
287
_env.
Assert
(info.LoadNames.Count > 0);
373
_env.
Assert
(screenWidth > 0);
Microsoft.ML.Mkl.Components (25)
OlsLinearRegression.cs (6)
238
ch.
Assert
(values.Length + 1 == m);
322
ch.
Assert
(values.Length + 1 == m);
326
ch.
Assert
(ioff == i * (i + 1) / 2);
336
ch.
Assert
(ioff == xtx.Length);
379
ch.
Assert
(ioff == xtx.Length - 1);
490
ch.
Assert
(!Double.IsNaN(rSquaredAdjusted));
SymSgdClassificationTrainer.cs (6)
203
ch.
Assert
(idvToFeedTrain.CanShuffle);
208
ch.
Assert
(examplesToFeedTrain.Schema.Label.HasValue);
209
ch.
Assert
(examplesToFeedTrain.Schema.Feature.HasValue);
211
ch.
Assert
(examplesToFeedTrain.Schema.Weight.HasValue);
415
_ch.
Assert
(_storage[_storageIndex].Length == _veryLongArrayLength);
427
_ch.
Assert
(instArrayLength * _sizeofT * 2 < _trainer.AcceleratedMemoryBudgetBytes);
VectorWhitening.cs (13)
311
ch.
Assert
(vectorType != null && vectorType.IsKnownSize);
357
ch.
Assert
(idxDst[i] == columnData[i].Length);
369
ch.
Assert
(columnData.Length == rowCounts.Length);
405
ch.
Assert
(r == 0);
460
ch.
Assert
(false);
480
Host.
Assert
(_columns.Length == ColumnPairs.Length);
589
Host.
Assert
(colIndex >= 0);
600
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
604
Host.
Assert
(ex.Kind == WhiteningKind.PrincipalComponentAnalysis || ex.Kind == WhiteningKind.ZeroPhaseComponentAnalysis);
649
Host.
Assert
(model.Length == dimension * dimension);
652
Host.
Assert
(parameters.Kind == WhiteningKind.PrincipalComponentAnalysis || parameters.Kind == WhiteningKind.ZeroPhaseComponentAnalysis);
674
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
676
Host.
Assert
(input.IsColumnActive(srcCol));
Microsoft.ML.OneDal (1)
OneDalUtils.cs (1)
58
channel.
Assert
(values.Length == numberOfFeatures);
Microsoft.ML.OnnxConverter (5)
OnnxContextImpl.cs (2)
149
_host.
Assert
(!_nodeNames.Contains(node.Name));
192
_host.
Assert
(_columnNameMap.ContainsKey(colName));
SaveOnnxCommand.cs (3)
184
ch.
Assert
(trans.CanSaveOnnx(ctx));
335
Host.
Assert
(transforms.Count == 0 || transforms.Last.Value == end);
355
Host.
Assert
(scorePipe.Source == end);
Microsoft.ML.PCA (3)
PcaTrainer.cs (2)
302
host.
Assert
(Utils.Size(y) == omega.Length); // Size of Y and Omega: dimension x oversampled rank
633
Host.
Assert
(src.Length == _dimension);
PcaTransformer.cs (1)
393
Host.
Assert
(mean.Length == omega.Length && omega.Length == y.Length && y.Length == _numColumns);
Microsoft.ML.Recommender (14)
MatrixFactorizationPredictor.cs (9)
96
_host.
Assert
(matrixColumnIndexType.RawType == typeof(uint));
97
_host.
Assert
(matrixRowIndexType.RawType == typeof(uint));
104
_host.
Assert
(NumberOfColumns == matrixColumnIndexType.GetCountAsInt32(_host));
105
_host.
Assert
(NumberOfRows == matrixRowIndexType.GetCountAsInt32(_host));
106
_host.
Assert
(_leftFactorMatrix.Length == NumberOfRows * ApproximationRank);
107
_host.
Assert
(_rightFactorMatrix.Length == ApproximationRank * NumberOfColumns);
297
_host.
Assert
(0 <= rowIndex && rowIndex < NumberOfRows);
298
_host.
Assert
(0 <= columnIndex && columnIndex < NumberOfColumns);
395
_env.
Assert
(Utils.Size(active) == OutputSchema.Count);
MatrixFactorizationTrainer.cs (2)
470
ch.
Assert
(rowCount > 0);
471
ch.
Assert
(colCount > 0);
SafeTrainingAndModelBuffer.cs (3)
254
_host.
Assert
(_pMFModel == null);
321
_host.
Assert
(_pMFModel == null);
353
_host.
Assert
(_pMFModel == null);
Microsoft.ML.StandardTrainers (160)
FactorizationMachine\FactorizationMachineTrainer.cs (5)
422
_host.
Assert
(!col.IsHidden);
427
_host.
Assert
(vectorType.Size > 0);
441
_host.
Assert
(fieldCount == validFeatureColumns.Count);
446
_host.
Assert
(featCol.Name == validFeatCol.Name);
447
_host.
Assert
(featCol.Type == validFeatCol.Type);
FactorizationMachine\FieldAwareFactorizationMachineModelParameters.cs (15)
79
Host.
Assert
(fieldCount > 0);
80
Host.
Assert
(featureCount > 0);
81
Host.
Assert
(latentDim > 0);
82
Host.
Assert
(Utils.Size(linearWeights) == featureCount);
84
Host.
Assert
(Utils.Size(latentWeights) == checked(featureCount * fieldCount * LatentDimAligned));
114
Host.
Assert
(fieldCount > 0);
115
Host.
Assert
(featureCount > 0);
116
Host.
Assert
(latentDim > 0);
117
Host.
Assert
(Utils.Size(linearWeights) == featureCount);
119
Host.
Assert
(latentWeightsAligned.Size == checked(featureCount * fieldCount * LatentDimAligned));
202
Host.
Assert
(FieldCount > 0);
203
Host.
Assert
(FeatureCount > 0);
204
Host.
Assert
(LatentDimension > 0);
205
Host.
Assert
(Utils.Size(_linearWeights) == FeatureCount);
206
Host.
Assert
(_latentWeightsAligned.Size == FeatureCount * FieldCount * LatentDimAligned);
LdSvm\LdSvmModelParameters.cs (41)
58
Host.
Assert
(treeDepth > 0 && treeDepth < 31);
61
Host.
Assert
(w.Length == numLeaf * 2 - 1);
62
Host.
Assert
(w.All(v => v.IsDense));
63
Host.
Assert
(w.All(v => v.Length == w[0].Length));
64
Host.
Assert
(thetaPrime.Length == numLeaf * 2 - 1);
65
Host.
Assert
(thetaPrime.All(v => v.IsDense));
66
Host.
Assert
(thetaPrime.All(v => v.Length == thetaPrime[0].Length));
67
Host.
Assert
(theta.Length == numLeaf - 1);
68
Host.
Assert
(theta.All(v => v.IsDense));
69
Host.
Assert
(theta.All(v => v.Length == theta[0].Length));
70
Host.
Assert
(biasW.Length == numLeaf * 2 - 1);
71
Host.
Assert
(biasTheta.Length == numLeaf - 1);
72
Host.
Assert
(biasThetaPrime.Length == numLeaf * 2 - 1);
73
Host.
Assert
((w[0].Length > 0) && (w[0].Length == thetaPrime[0].Length) && (w[0].Length == theta[0].Length));
128
Host.
Assert
(_numLeaf > 1 && (_numLeaf & (_numLeaf - 1)) == 0); // Check if _numLeaf is power of 2
129
Host.
Assert
(_w.Length == _numLeaf * 2 - 1);
130
Host.
Assert
(_w.All(v => v.IsDense));
131
Host.
Assert
(_w.All(v => v.Length == _w[0].Length));
132
Host.
Assert
(_thetaPrime.Length == _numLeaf * 2 - 1);
133
Host.
Assert
(_thetaPrime.All(v => v.IsDense));
134
Host.
Assert
(_thetaPrime.All(v => v.Length == _thetaPrime[0].Length));
135
Host.
Assert
(_theta.Length == _numLeaf - 1);
136
Host.
Assert
(_theta.All(v => v.IsDense));
137
Host.
Assert
(_theta.All(v => v.Length == _theta[0].Length));
138
Host.
Assert
(_biasW.Length == _numLeaf * 2 - 1);
139
Host.
Assert
(_biasTheta.Length == _numLeaf - 1);
140
Host.
Assert
(_biasThetaPrime.Length == _numLeaf * 2 - 1);
141
Host.
Assert
((_w[0].Length > 0) && (_w[0].Length == _thetaPrime[0].Length) && (_w[0].Length == _theta[0].Length)); // numFeatures
142
Host.
Assert
(InputType != null && InputType.GetVectorSize() == _w[0].Length);
186
Host.
Assert
(_w.Length == _numLeaf * 2 - 1);
188
Host.
Assert
(_thetaPrime.Length == _numLeaf * 2 - 1);
190
Host.
Assert
(_theta.Length == _numLeaf - 1);
193
Host.
Assert
(_biasW.Length == _numLeaf * 2 - 1);
195
Host.
Assert
(_biasTheta.Length == _numLeaf - 1);
197
Host.
Assert
(_biasThetaPrime.Length == _numLeaf * 2 - 1);
215
Host.
Assert
(vector.IsDense);
216
Host.
Assert
(vector.Length == vectorLength);
230
Host.
Assert
(length >= 0);
231
Host.
Assert
(vectorLength >= 0);
238
Host.
Assert
(result[i].IsDense);
239
Host.
Assert
(result[i].Length == vectorLength);
LdSvm\LdSvmTrainer.cs (12)
408
Host.
Assert
(Utils.Size(tempW) == count);
409
Host.
Assert
(Utils.Size(w) == count);
410
Host.
Assert
(Utils.Size(theta) == half);
411
Host.
Assert
(Utils.Size(thetaPrime) == count);
412
Host.
Assert
(Utils.Size(biasW) == count);
413
Host.
Assert
(Utils.Size(biasTheta) == half);
414
Host.
Assert
(Utils.Size(biasThetaPrime) == count);
415
Host.
Assert
(Utils.Size(tempThetaPrime) == count);
416
Host.
Assert
(Utils.Size(tempTheta) == half);
417
Host.
Assert
(Utils.Size(tempBiasW) == count);
418
Host.
Assert
(Utils.Size(tempBiasTheta) == half);
419
Host.
Assert
(Utils.Size(tempBiasThetaPrime) == count);
Optimizer\L1Optimizer.cs (2)
80
ch.
Assert
(0 <= biasCount && biasCount < initial.Length);
81
ch.
Assert
(l1Weight > 0);
Standard\LinearModelParameters.cs (1)
172
Host.
Assert
(len > 0);
Standard\LogisticRegression\LbfgsPredictorBase.cs (11)
470
ch.
Assert
(numThreads > 0);
509
ch.
Assert
(values.Length == nFeatures);
572
ch.
Assert
(numThreads > 0);
620
ch.
Assert
(cursor.KeptRowCount <= int.MaxValue);
648
ch.
Assert
(numThreads > 1);
659
ch.
Assert
(numThreads > 0);
668
ch.
Assert
(0 < cchkLeft && cchkLeft <= numThreads);
670
ch.
Assert
(0 < cinstThis && cinstThis <= cinstTot - iinstMin);
681
ch.
Assert
(_numChunks > 0 && _data == null);
688
ch.
Assert
(_numChunks == 0 && _data != null);
709
ch.
Assert
(CurrentWeights.Length == BiasCount + WeightCount);
Standard\LogisticRegression\LogisticRegression.cs (3)
274
Host.
Assert
(namesSpans.Length == featureLength);
364
ch.
Assert
(ioff == i * (i + 1) / 2);
378
ch.
Assert
(ioff == hessian.Length);
Standard\LogisticRegression\MulticlassLogisticRegression.cs (11)
629
Host.
Assert
(Biases.Length == NumberOfClasses);
630
Host.
Assert
(Biases.Length == Weights.Length);
633
Host.
Assert
(fw.Length == NumberOfFeatures);
664
Host.
Assert
(fv.Length == NumberOfFeatures);
714
Host.
Assert
(count == numIndices);
741
Host.
Assert
(count == numIndices);
878
Host.
Assert
(namedValues.Value is float);
985
Host.
Assert
(outputs[0] == DefaultColumnNames.PredictedLabel);
986
Host.
Assert
(outputs[1] == DefaultColumnNames.Score);
1052
Host.
Assert
(featuresCount == Weights[i].Length);
1241
Host.
Assert
(dst.Length == NumberOfClasses);
Standard\ModelStatistics.cs (15)
97
Env.
Assert
(trainingExampleCount > 0);
98
Env.
Assert
(paramCount > 0);
144
Env.
Assert
(ParametersCount > 0);
147
Env.
Assert
(TrainingExampleCount > 0);
248
Env.
Assert
(trainingExampleCount > 0);
249
Env.
Assert
(paramCount > 0);
285
env.
Assert
(length > ParametersCount);
320
Env.
Assert
(coeffStdErrorValues.Length == ParametersCount);
408
Env.
Assert
(_coeffStdError.Length == _weights.Length + 1);
420
Env.
Assert
(0 <= wi && wi < _weights.Length);
445
Env.
Assert
(0 <= wi && wi < _weights.Length);
484
Env.
Assert
(featureNames.Length >= 1);
493
Env.
Assert
(0 <= probZ && probZ <= 1);
514
Env.
Assert
(coeffStat.Index < featureNames.Length);
549
Env.
Assert
(coeffStat.Index < featureNames.Length);
Standard\MulticlassClassification\MetaMulticlassTrainer.cs (3)
94
Host.
Assert
(type.RawType == typeof(T));
97
Host.
Assert
(data.Schema.Label.HasValue);
126
Host.
Assert
(count > 0);
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (3)
296
Host.
Assert
(labelHistogram.Length == featureHistogram.Length);
297
Host.
Assert
(featureHistogram.All(h => h == null || h.Length == featureCount));
591
Host.
Assert
(featureCount >= 0);
Standard\MulticlassClassification\OneVersusAllTrainer.cs (3)
194
Host.
Assert
(!label.IsHidden);
195
Host.
Assert
(label.Type.GetKeyCount() > 0 || label.Type == NumberDataViewType.Single || label.Type == NumberDataViewType.Double);
360
Host.
Assert
(Utils.Size(impl.Predictors) > 0);
Standard\MulticlassClassification\PairwiseCouplingTrainer.cs (14)
167
Host.
Assert
(!label.IsHidden);
168
Host.
Assert
(label.Type.GetKeyCount() > 0 || label.Type == NumberDataViewType.Single || label.Type == NumberDataViewType.Double);
265
Host.
Assert
(Utils.Size(predictors) > 0);
273
Host.
Assert
(Utils.Size(predictors[i]) == i + 1);
276
Host.
Assert
(index == GetIndex(i, j));
280
Host.
Assert
(index == _predictors.Length);
304
Host.
Assert
(index == GetIndex(i, j));
307
Host.
Assert
(index == GetIndex(i, i));
381
Host.
Assert
(0 <= value && value <= 1);
414
Host.
Assert
(index == GetIndex(j, i));
435
Host.
Assert
(values[index + j] >= pii);
442
Host.
Assert
(index == GetIndex(j, i));
443
Host.
Assert
(values[index] >= pii);
454
Host.
Assert
(0 <= j && j <= i && i < _numClasses);
Standard\Online\OnlineLinear.cs (4)
129
ch.
Assert
(Iteration == 0);
130
ch.
Assert
(Bias == 0);
229
ch.
Assert
(FloatUtils.IsFinite(feat.GetValues()));
297
ch.
Assert
(state.WeightsScale == 1);
Standard\SdcaBinary.cs (12)
114
ch.
Assert
(idvToFeedTrain.CanShuffle);
119
ch.
Assert
(examplesToFeedTrain.Schema.Label.HasValue);
120
ch.
Assert
(examplesToFeedTrain.Schema.Feature.HasValue);
122
ch.
Assert
(examplesToFeedTrain.Schema.Weight.HasValue);
344
ch.
Assert
(numThreads > 0);
362
ch.
Assert
(checkFrequency > 0);
464
ch.
Assert
(SdcaTrainerOptions.L1Regularization.HasValue);
494
ch.
Assert
(SdcaTrainerOptions.L2Regularization.HasValue);
557
ch.
Assert
(metricNames.Length == metrics.Length);
558
ch.
Assert
(SdcaTrainerOptions.MaximumNumberOfIterations.HasValue);
989
Host.
Assert
(idToIdx == null || row == duals.Length);
2043
ch.
Assert
(numThreads > 0);
Standard\SdcaMulticlass.cs (1)
408
Host.
Assert
(idToIdx == null || row * numClasses == duals.Length);
Standard\StochasticTrainerBase.cs (4)
78
ch.
Assert
(idvToFeedTrain.CanShuffle);
83
ch.
Assert
(examplesToFeedTrain.Schema.Label.HasValue);
84
ch.
Assert
(examplesToFeedTrain.Schema.Feature.HasValue);
86
ch.
Assert
(examplesToFeedTrain.Schema.Weight.HasValue);
Microsoft.ML.Sweeper (14)
Algorithms\KdoSweeper.cs (6)
159
_host.
Assert
(Utils.Size(previousRuns) > 1);
179
_host.
Assert
(history.Length == weights.Length && parentIndicies.Max() < history.Length);
447
_host.
Assert
(weights.Sum() > 0);
455
_host.
Assert
(d > 0 && diagonalCovariance.Length == d);
458
_host.
Assert
(diagonalCovariance[i].Length == d);
461
_host.
Assert
((i == j && diagonalCovariance[i][j] >= 0) || diagonalCovariance[i][j] == 0);
Algorithms\SmacSweeper.cs (5)
211
_host.
Assert
(randomConfigs.Length == randomEIs.Length);
299
_host.
Assert
(hotIndex >= 0);
439
_host.
Assert
(parameterSet.Count == _sweepParameters.Length);
440
_host.
Assert
(index >= 0 && index <= _sweepParameters.Length);
458
_host.
Assert
(hotIndex >= 0);
Algorithms\SweeperProbabilityUtils.cs (3)
162
host.
Assert
(ps.Count == sweepParams.Length);
187
host.
Assert
(hotIndex >= 0);
234
host.
Assert
(hotIndex >= i);
Microsoft.ML.TensorFlow (3)
TensorflowTransform.cs (3)
175
env.
Assert
(actualRead == fileLength);
489
Host.
Assert
(actualWritten == fileLength);
648
Host.
Assert
(type == _parent.OutputTypes[iinfo].GetItemType().RawType);
Microsoft.ML.TimeSeries (125)
AdaptiveSingularSpectrumSequenceModeler.cs (16)
298
_host.
Assert
(model._windowSize >= 2);
299
_host.
Assert
(model._seriesLength > model._windowSize);
300
_host.
Assert
(model._trainSize > 2 * model._windowSize);
301
_host.
Assert
(0 <= model._discountFactor && model._discountFactor <= 1);
302
_host.
Assert
(1 <= model._rank && model._rank < model._windowSize);
454
_host.
Assert
(_windowSize >= 2);
455
_host.
Assert
(_seriesLength > _windowSize);
456
_host.
Assert
(_trainSize > 2 * _windowSize);
457
_host.
Assert
(0 <= _discountFactor && _discountFactor <= 1);
458
_host.
Assert
(1 <= _rank && _rank < _windowSize);
459
_host.
Assert
(Utils.Size(_alpha) == _windowSize - 1);
460
_host.
Assert
(_observationNoiseVariance >= 0);
461
_host.
Assert
(_autoregressionNoiseVariance >= 0);
462
_host.
Assert
(1 <= _maxRank && _maxRank <= _windowSize - 1);
463
_host.
Assert
(_maxTrendRatio >= 0);
1253
_host.
Assert
(Utils.Size(dataArray) > 0);
ExponentialAverageTransform.cs (2)
83
Host.
Assert
(WindowSize >= 1);
84
Host.
Assert
(0 <= _decay && _decay <= 1);
IidAnomalyDetectionBase.cs (1)
141
Host.
Assert
(InitialWindowSize == 0);
IidChangePointDetector.cs (2)
179
InternalTransform.Host.
Assert
(InternalTransform.ThresholdScore == AlertingScore.MartingaleScore);
180
InternalTransform.Host.
Assert
(InternalTransform.Side == AnomalySide.TwoSided);
IidSpikeDetector.cs (1)
160
InternalTransform.Host.
Assert
(InternalTransform.ThresholdScore == AlertingScore.PValueScore);
MovingAverageTransform.cs (3)
99
Host.
Assert
(WindowSize >= 1);
100
Host.
Assert
(_lag >= 0);
111
Host.
Assert
(_weights == null || Utils.Size(_weights) == WindowSize + 1 - _lag);
PercentileThresholdTransform.cs (2)
90
Host.
Assert
(MinPercentile <= _percentile && _percentile <= MaxPercentile);
91
Host.
Assert
(WindowSize >= 1);
PValueTransform.cs (1)
95
Host.
Assert
(WindowSize >= 1);
SequentialAnomalyDetectionTransformBase.cs (17)
240
Host.
Assert
(Enum.IsDefined(typeof(MartingaleType), Martingale));
241
Host.
Assert
(Enum.IsDefined(typeof(AlertingScore), ThresholdScore));
242
Host.
Assert
(Martingale != MartingaleType.None || ThresholdScore != AlertingScore.MartingaleScore);
243
Host.
Assert
(WindowSize > 0 || ThresholdScore == AlertingScore.RawScore);
244
Host.
Assert
(Enum.IsDefined(typeof(AnomalySide), Side));
245
Host.
Assert
(0 < PowerMartingaleEpsilon && PowerMartingaleEpsilon < 1);
246
Host.
Assert
(AlertThreshold >= 0);
247
Host.
Assert
(ThresholdScore != AlertingScore.PValueScore || (0 <= AlertThreshold && AlertThreshold <= 1));
274
Host.
Assert
(MinPValue > 0);
275
Host.
Assert
(MaxPValue < 1);
276
Host.
Assert
(MinPValue <= p && p <= MaxPValue);
277
Host.
Assert
(0 < epsilon && epsilon < 1);
290
Host.
Assert
(MinPValue > 0);
291
Host.
Assert
(MaxPValue < 1);
292
Host.
Assert
(MinPValue <= p && p <= MaxPValue);
525
Host.
Assert
(outputLength >= 2);
658
Host.
Assert
(WindowSize >= 0);
SequentialForecastingTransformBase.cs (1)
309
Host.
Assert
(WindowSize >= 0);
SequentialTransformBase.cs (6)
139
Host.
Assert
(_isIniatilized);
140
Host.
Assert
(WindowedBuffer != null);
141
Host.
Assert
(InitialWindowedBuffer != null);
329
Host.
Assert
(InitialWindowSize >= 0);
330
Host.
Assert
(WindowSize >= 0);
403
Ch.
Assert
(input.Schema.Count == parent.OutputSchema.Count);
SequentialTransformerBase.cs (5)
133
Host.
Assert
(WindowedBuffer != null);
134
Host.
Assert
(InitialWindowedBuffer != null);
420
Host.
Assert
(InitialWindowSize >= 0);
421
Host.
Assert
(WindowSize >= 0);
698
Ch.
Assert
(input.Schema.Count == parent.OutputSchema.Count);
SlidingWindowTransformBase.cs (4)
70
Host.
Assert
(args.WindowSize == 1);
112
Host.
Assert
(WindowSize >= 1);
113
Host.
Assert
(_lag >= 0);
114
Host.
Assert
(Enum.IsDefined(typeof(BeginOptions), _begin));
SrCnnTransformBase.cs (7)
125
Host.
Assert
(WindowSize > 0);
126
Host.
Assert
(InitialWindowSize == WindowSize);
127
Host.
Assert
(BackAddWindowSize > 0);
128
Host.
Assert
(LookaheadWindowSize > 0);
129
Host.
Assert
(AvergingWindowSize > 0);
130
Host.
Assert
(JudgementWindowSize > 0);
131
Host.
Assert
(AlertThreshold >= 0 && AlertThreshold <= 1);
SsaAnomalyDetectionBase.cs (5)
269
Host.
Assert
(InitialWindowSize == 0);
270
Host.
Assert
(2 <= SeasonalWindowSize);
271
Host.
Assert
(0 <= DiscountFactor && DiscountFactor <= 1);
272
Host.
Assert
(Enum.IsDefined(typeof(ErrorFunction), ErrorFunction));
273
Host.
Assert
(Model != null);
SsaChangePointDetector.cs (5)
143
InternalTransform.Host.
Assert
(!Enum.IsDefined(typeof(MartingaleType), InternalTransform.Martingale));
186
InternalTransform.Host.
Assert
(InternalTransform.ThresholdScore == AlertingScore.MartingaleScore);
187
InternalTransform.Host.
Assert
(InternalTransform.Side == AnomalySide.TwoSided);
188
InternalTransform.Host.
Assert
(InternalTransform.DiscountFactor == 1);
189
InternalTransform.Host.
Assert
(InternalTransform.IsAdaptive == false);
SSaForecasting.cs (1)
193
InternalTransform.Host.
Assert
(InternalTransform.IsAdaptive == false);
SsaForecastingBase.cs (2)
193
Host.
Assert
(InitialWindowSize == 0);
194
Host.
Assert
(Model != null);
SsaSpikeDetector.cs (3)
168
InternalTransform.Host.
Assert
(InternalTransform.ThresholdScore == AlertingScore.PValueScore);
169
InternalTransform.Host.
Assert
(InternalTransform.DiscountFactor == 1);
170
InternalTransform.Host.
Assert
(InternalTransform.IsAdaptive == false);
TrajectoryMatrix.cs (41)
192
_ectx.
Assert
(Utils.Size(cov) >= _windowSize * _windowSize);
264
_ectx.
Assert
(srcIndex >= 0);
265
_ectx.
Assert
(dstIndex >= 0);
266
_ectx.
Assert
(Utils.Size(vector) >= _k + srcIndex);
267
_ectx.
Assert
(Utils.Size(result) >= _windowSize + dstIndex);
294
_ectx.
Assert
(srcIndex >= 0);
295
_ectx.
Assert
(dstIndex >= 0);
296
_ectx.
Assert
(Utils.Size(vector) >= _k + srcIndex);
297
_ectx.
Assert
(Utils.Size(result) >= _windowSize + dstIndex);
368
_ectx.
Assert
(srcIndex >= 0);
369
_ectx.
Assert
(dstIndex >= 0);
370
_ectx.
Assert
(Utils.Size(vector) >= _windowSize + srcIndex);
371
_ectx.
Assert
(Utils.Size(result) >= _k + dstIndex);
398
_ectx.
Assert
(srcIndex >= 0);
399
_ectx.
Assert
(dstIndex >= 0);
400
_ectx.
Assert
(Utils.Size(vector) >= _windowSize + srcIndex);
401
_ectx.
Assert
(Utils.Size(result) >= _k + dstIndex);
489
_ectx.
Assert
(0 <= ue && ue < _windowSize);
490
_ectx.
Assert
(0 <= us && us <= ue);
491
_ectx.
Assert
(0 <= ve && ve < _k);
492
_ectx.
Assert
(0 <= vs && vs <= ve);
498
_ectx.
Assert
(uIndex >= 0);
499
_ectx.
Assert
(vIndex >= 0);
500
_ectx.
Assert
(dstIndex >= 0);
501
_ectx.
Assert
(Utils.Size(u) >= _windowSize + uIndex);
502
_ectx.
Assert
(Utils.Size(v) >= _k + vIndex);
503
_ectx.
Assert
(Utils.Size(result) >= len + dstIndex);
504
_ectx.
Assert
(!Single.IsNaN(sigma));
505
_ectx.
Assert
(!Single.IsInfinity(sigma));
562
_ectx.
Assert
(0 <= ue && ue < _windowSize);
563
_ectx.
Assert
(0 <= us && us <= ue);
564
_ectx.
Assert
(0 <= ve && ve < _k);
565
_ectx.
Assert
(0 <= vs && vs <= ve);
569
_ectx.
Assert
(uIndex >= 0);
570
_ectx.
Assert
(vIndex >= 0);
571
_ectx.
Assert
(dstIndex >= 0);
572
_ectx.
Assert
(Utils.Size(u) >= _windowSize + uIndex);
573
_ectx.
Assert
(Utils.Size(v) >= _k + vIndex);
574
_ectx.
Assert
(Utils.Size(result) >= len + dstIndex);
575
_ectx.
Assert
(!Single.IsNaN(sigma));
576
_ectx.
Assert
(!Single.IsInfinity(sigma));
Microsoft.ML.Transforms (299)
Dracula\CountTableTransformer.cs (12)
151
_host.
Assert
(_initialCounts != null || _sharedBuilder != null || _builders != null);
164
_host.
Assert
(col.HasValue);
226
_host.
Assert
(type is KeyDataViewType || type is NumberDataViewType || type is BooleanDataViewType);
244
_host.
Assert
(type.GetKeyCount() > 0);
298
_host.
Assert
(data.Schema.Label.HasValue);
447
Host.
Assert
(Utils.Size(seeds) == featurizer.ColCount);
579
Host.
Assert
(!string.IsNullOrEmpty(_labelClassNames[i]));
635
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
640
Host.
Assert
(inputCol.HasSlotNames());
646
Host.
Assert
(inputSlotNames.Length == inputCol.Type.GetValueCount());
682
Host.
Assert
(_parent.Featurizer.SlotCount[iinfo] == 1);
701
Host.
Assert
(_parent.Featurizer.SlotCount[iinfo] == n);
Dracula\Featurizer.cs (6)
140
_host.
Assert
(features.Length == NumFeatures);
163
_host.
Assert
(FloatUtils.IsFinite(features));
173
_host.
Assert
(_labelBinCount == counts.Length);
194
_host.
Assert
(counts.Length == _labelBinCount);
195
_host.
Assert
(logOdds.Length == _logOddsCount);
199
_host.
Assert
(counts[i] >= 0);
Dracula\MultiCountTable.cs (5)
101
_host.
Assert
(size > 0);
112
_host.
Assert
(0 <= iCol && iCol < _countTableBuilders.Length);
113
_host.
Assert
(0 <= iSlot && iSlot < _countTableBuilders[iCol].Length);
181
Host.
Assert
(_countTables.Length > 0);
187
Host.
Assert
(size > 0);
Expression\LambdaBinder.cs (54)
61
env.
Assert
(binder._rgwith.Count == 0);
111
_host.
Assert
(node.IsBool);
118
_host.
Assert
(node.IsTX);
125
_host.
Assert
(node.IsNumber || node.IsError);
126
_host.
Assert
((node.ExprValue == null) == node.IsError);
143
_host.
Assert
(HasErrors);
180
_host.
Assert
(node.ExprType != 0);
192
_host.
Assert
(_lambda == node);
200
_host.
Assert
(false);
226
_host.
Assert
(HasErrors);
232
_host.
Assert
(HasErrors);
240
_host.
Assert
(HasErrors);
253
_host.
Assert
(HasErrors);
292
_host.
Assert
(false);
342
_host.
Assert
(HasErrors);
347
_host.
Assert
(false);
357
_host.
Assert
(node.Op == BinaryOp.And || node.Op == BinaryOp.Or || node.Op == BinaryOp.Coalesce);
393
_host.
Assert
(node.IsBool);
418
_host.
Assert
(MapKindToIndex(kind) >= 0);
741
_host.
Assert
(false);
763
_host.
Assert
(false);
787
_host.
Assert
(false);
811
_host.
Assert
(false);
994
_host.
Assert
(HasErrors);
1013
_host.
Assert
(false);
1039
_host.
Assert
(false);
1043
_host.
Assert
((cmpLax == null) == (cmpStrict == null));
1068
_host.
Assert
(arg.ExprType == kind);
1070
_host.
Assert
(valuePrev != null);
1074
_host.
Assert
(tid == tidLax || tid == tidStrict);
1080
_host.
Assert
(arg.ExprType == kind);
1083
_host.
Assert
(value != null);
1101
_host.
Assert
(arg.ExprType == kind);
1104
_host.
Assert
(value != null);
1108
_host.
Assert
(arg2.ExprType == kind);
1111
_host.
Assert
(value2 != null);
1391
_host.
Assert
(candidates.Count > 0);
1392
_host.
Assert
(count == 0 || count == candidates.Count);
1403
_host.
Assert
(0 <= icandMinBad && icandMinBad < candidates.Count);
1422
_host.
Assert
(!best.IsVariable);
1423
_host.
Assert
(best.Arity == 1);
1443
_host.
Assert
(tail >= 0);
1445
_host.
Assert
(type.IsArray);
1455
_host.
Assert
(res != null);
1456
_host.
Assert
(res.GetType() == best.Method.ReturnType);
1552
_host.
Assert
(Utils.Size(candidates) >= 2);
1587
_host.
Assert
((dup1 != null) == (dup2 != null));
1621
_host.
Assert
(_rgwith.Count == iwith + 1);
1622
_host.
Assert
(_rgwith[iwith] == node);
1624
_host.
Assert
(_rgwith.Count == iwith);
1633
_host.
Assert
(false);
1647
_host.
Assert
(expr.ExprType != 0);
1653
_host.
Assert
(HasErrors);
1666
_host.
Assert
(HasErrors);
ExpressionTransformer.cs (32)
187
_host.
Assert
(typeRes is PrimitiveDataViewType);
201
_host.
Assert
(b);
261
ectx.
Assert
(Utils.Size(inputTypes) == Utils.Size(inputColumnNames));
412
Host.
Assert
(_columns[i].VectorInputColumn >= -1);
461
ectx.
Assert
(inputColumns.Length == 1);
476
ectx.
Assert
(inputColumns.Length == 2);
494
ectx.
Assert
(inputColumns.Length == 3);
515
ectx.
Assert
(inputColumns.Length == 4);
539
ectx.
Assert
(inputColumns.Length == 5);
566
ectx.
Assert
(_columns[iinfo].VectorInputColumn >= 0);
603
ectx.
Assert
(inputColumns.Length == 1);
604
ectx.
Assert
(perm.Length == 1);
605
ectx.
Assert
(perm[0] == 0);
650
ectx.
Assert
(0 <= ii && ii <= count);
651
ectx.
Assert
(ii == count || src0.GetIndices()[ii] >= i);
668
ectx.
Assert
(inputColumns.Length == 2);
669
ectx.
Assert
(perm.Length == 2);
710
ectx.
Assert
(0 <= ii && ii <= count);
711
ectx.
Assert
(ii == count || src0.GetIndices()[ii] >= i);
728
ectx.
Assert
(inputColumns.Length == 3);
729
ectx.
Assert
(perm.Length == 3);
773
ectx.
Assert
(0 <= ii && ii <= count);
774
ectx.
Assert
(ii == count || src0.GetIndices()[ii] >= i);
791
ectx.
Assert
(inputColumns.Length == 4);
792
ectx.
Assert
(perm.Length == 4);
839
ectx.
Assert
(0 <= ii && ii <= count);
840
ectx.
Assert
(ii == count || src0.GetIndices()[ii] >= i);
857
ectx.
Assert
(inputColumns.Length == 5);
858
ectx.
Assert
(perm.Length == 5);
908
ectx.
Assert
(0 <= ii && ii <= count);
909
ectx.
Assert
(ii == count || src0.GetIndices()[ii] >= i);
968
_parent.Host.
Assert
(0 <= iinfo && iinfo < _parent._columns.Length);
GcnTransform.cs (6)
310
Host.
Assert
(_columns.Length == ColumnPairs.Length);
367
Host.
Assert
(0 < ex.Scale && ex.Scale < float.PositiveInfinity);
368
Host.
Assert
(_srcTypes[iinfo] is VectorDataViewType);
478
ectx.
Assert
(divisor >= 0);
485
ectx.
Assert
(count > 0);
486
ectx.
Assert
(length > 0);
GroupTransform.cs (3)
581
Ch.
Assert
(_leadingCursor.Position >= 0);
595
Ch.
Assert
(groupSize > 0);
605
Ch.
Assert
(res);
HashJoiningTransform.cs (12)
202
Host.
Assert
(Infos.Length == Utils.Size(args.Columns));
311
Host.
Assert
(NumBitsMin <= ex.NumberOfBits && ex.NumberOfBits < NumBitsLim);
323
Host.
Assert
(ex.SlotMap[i].Distinct().Count() == ex.SlotMap[i].Length);
324
Host.
Assert
(ex.SlotMap[i].All(slot => 0 <= slot && slot < Infos[iColumn].TypeSrc.GetValueCount()));
340
Host.
Assert
(Utils.Size(slotMap) >= 1);
411
Host.
Assert
(0 <= iinfo && iinfo < Infos.Length);
470
Host.
Assert
(0 <= iinfo && iinfo < Infos.Length);
505
Host.
Assert
(!(Infos[iinfo].TypeSrc is VectorDataViewType));
530
Host.
Assert
(srcType != null);
578
Host.
Assert
(srcType != null);
579
Host.
Assert
(Utils.Size(_exes[iinfo].SlotMap) == 1);
655
Host.
Assert
(iinfo >= 0 && iinfo < _exes.Length);
KeyToVectorMapping.cs (15)
178
Host.
Assert
(_bitsPerKey[i] > 0);
209
Host.
Assert
(colIndex >= 0);
281
Host.
Assert
(0 <= iinfo && iinfo < _infos.Length);
282
Host.
Assert
(_types[iinfo].IsKnownSize);
287
Host.
Assert
(srcVectorSize > 1);
305
Host.
Assert
(slotLim == (long)srcVectorSize * _bitsPerKey[iinfo]);
331
Host.
Assert
(slot == slotLim);
339
Host.
Assert
(0 <= iinfo && iinfo < _infos.Length);
354
Host.
Assert
(_infos[iinfo].TypeSrc is KeyDataViewType);
357
Host.
Assert
(bitsPerKey == _types[iinfo].Size);
360
Host.
Assert
(dstLength > 0);
362
Host.
Assert
(srcCol >= 0);
385
Host.
Assert
(typeSrc.ItemType is KeyDataViewType);
388
Host.
Assert
(cv >= 0);
390
Host.
Assert
(srcCol >= 0);
LearnerFeatureSelection.cs (1)
271
host.
Assert
(options.Threshold.HasValue != options.NumSlotsToKeep.HasValue);
LoadTransform.cs (1)
122
h.
Assert
(currentView is IDataTransform);
MissingValueDroppingTransformer.cs (8)
244
Host.
Assert
(!isNA(in def));
264
Host.
Assert
(newCount <= srcValues.Length);
277
Host.
Assert
(dst.GetValues().Length == newCount);
292
Host.
Assert
(iDst == newCount);
308
Host.
Assert
(newCount <= srcValues.Length);
334
Host.
Assert
(iDst == newCount);
355
Host.
Assert
(iDst == newCount);
356
Host.
Assert
(offset == srcValues.Length - newCount);
MissingValueIndicatorTransform.cs (15)
80
Host.
Assert
(Infos.Length == Utils.Size(args.Columns));
171
Host.
Assert
(0 <= iinfo && iinfo < Infos.Length);
177
Host.
Assert
(0 <= iinfo && iinfo < Infos.Length);
188
Host.
Assert
(_types[iinfo].Size == 2);
195
Host.
Assert
(srcVectorType.IsKnownSize);
196
Host.
Assert
(size == 2 * srcVectorType.Size);
215
Host.
Assert
(0 <= slot && slot < size);
216
Host.
Assert
(slot % 2 == 0);
231
Host.
Assert
(slot == size);
241
Host.
Assert
(0 <= iinfo && iinfo < Infos.Length);
264
Host.
Assert
(dst.Length == 2);
308
ectx.
Assert
(iivDst <= ivSrc);
333
ectx.
Assert
(iivDst <= iivSrc);
338
ectx.
Assert
(ivPrev < iv && iv < size);
354
ectx.
Assert
(0 <= iivDst && iivDst <= values.Length);
MissingValueIndicatorTransformer.cs (13)
209
Host.
Assert
(colIndex >= 0);
238
Host.
Assert
(0 <= iinfo && iinfo < _infos.Length);
373
Host.
Assert
(dstCount <= srcLength);
391
Host.
Assert
(0 <= i && i <= iNext);
392
Host.
Assert
(iiSrc + iiDst == i);
395
Host.
Assert
(iiDst < dstCount);
401
Host.
Assert
(iiSrc + 1 < indices.Count);
402
Host.
Assert
(iNext < indices[iiSrc + 1]);
406
Host.
Assert
(srcLength == iiSrc + iiDst);
407
Host.
Assert
(iiDst == dstCount);
423
Host.
Assert
(0 <= i && i <= indices[ii]);
428
Host.
Assert
(ii < indices.Count);
429
Host.
Assert
(indices[ii - 1] < indices[ii]);
MissingValueReplacing.cs (30)
249
Host.
Assert
(repValue.GetType() == _replaceTypes[i].RawType || repValue.GetType() == _replaceTypes[i].GetItemType().RawType);
255
Host.
Assert
(srcType != null);
256
Host.
Assert
(srcType.Size == src.Length);
268
Host.
Assert
(valReturn.Length == src.Length);
318
Host.
Assert
(false);
369
Host.
Assert
(values.Length == type.GetVectorSize());
489
Host.
Assert
(type.RawType == typeof(T) || type.GetItemType().RawType == typeof(T));
510
Host.
Assert
(repValue is Array);
516
Host.
Assert
(!(repValue is Array));
519
Host.
Assert
(repValue.GetType() == _replaceTypes[iinfo].RawType || repValue.GetType() == _replaceTypes[iinfo].GetItemType().RawType);
614
Host.
Assert
(colIndex >= 0);
625
Host.
Assert
(0 <= iinfo && iinfo < _infos.Length);
647
Host.
Assert
(_parent._repValues[iinfo] is T);
680
Host.
Assert
(_parent._repValues[iinfo] is T);
692
Host.
Assert
(_parent._repValues[iinfo] is T[]);
725
Host.
Assert
(srcSize == srcCount);
743
Host.
Assert
(srcCount < srcSize);
750
Host.
Assert
(iivDst <= iivSrc);
753
Host.
Assert
(ivPrev < iv && iv < srcSize);
768
Host.
Assert
(iivDst <= srcCount);
770
Host.
Assert
(0 <= iivDst);
771
Host.
Assert
(repIsDefault || iivDst == srcCount);
781
Host.
Assert
(rep.Length == src.Length);
783
Host.
Assert
(repIsDefault.Length == src.Length);
799
Host.
Assert
(srcSize == srcCount);
817
Host.
Assert
(srcCount < srcSize);
824
Host.
Assert
(iivDst <= iivSrc);
827
Host.
Assert
(ivPrev < iv && iv < srcSize);
842
Host.
Assert
(iivDst <= srcCount);
844
Host.
Assert
(0 <= iivDst);
MissingValueReplacingUtils.cs (14)
19
ch.
Assert
(type.GetItemType() is NumberDataViewType);
99
ch.
Assert
(false);
189
Ch.
Assert
(0 <= col);
238
Ch.
Assert
(type.IsKnownSize);
351
Ch.
Assert
(0 <= slot && slot < Stat.Length);
550
Ch.
Assert
(float.MinValue <= val && val <= float.MaxValue);
570
Ch.
Assert
(float.MinValue <= val && val <= float.MaxValue);
584
Ch.
Assert
(0 <= slot && slot < Stat.Length);
594
Ch.
Assert
(float.MinValue <= val && val <= float.MaxValue);
666
Ch.
Assert
(0 <= slot && slot < Stat.Length);
673
Ch.
Assert
(0 <= slot && slot < Stat.Length);
806
Ch.
Assert
(0 <= slot && slot < Stat.Length);
884
Ch.
Assert
(0 <= slot && slot < Stat.Length);
894
Ch.
Assert
(0 <= slot && slot < Stat.Length);
OptionalColumnTransform.cs (2)
489
Ch.
Assert
(originFn != null);
520
Host.
Assert
(((ICanSaveOnnx)this).CanSaveOnnx(ctx));
ProduceIdTransform.cs (2)
198
Ch.
Assert
(index == 0);
217
Ch.
Assert
(index == 0);
RandomFourierFeaturizing.cs (1)
367
Host.
Assert
(count == distances.Length);
StatefulCustomMappingTransformer.cs (2)
276
Ch.
Assert
(active == null || active.Length == parent.OutputSchema.Count);
322
Ch.
Assert
(originFn != null);
SvmLight\SvmLightLoader.cs (6)
475
Ch.
Assert
(_isActive);
510
Ch.
Assert
(-1 <= _fileIdx && _fileIdx < _parent._files.Count);
572
_host.
Assert
(_featureCount <= int.MaxValue);
583
_host.
Assert
(keyCol.HasValue);
678
env.
Assert
(col.HasValue);
721
env.
Assert
(schemaDef.Count == 1);
Text\LdaTransform.cs (4)
248
ectx.
Assert
(numVocab >= 0);
827
ch.
Assert
(states.Length == columns.Length);
922
ch.
Assert
(numDocArray[i] < rowCount);
965
env.
Assert
(corpusSize[i] == docSizeCheck[i]);
Text\NgramHashingTransformer.cs (3)
553
Host.
Assert
(0 <= lim && lim <= Utils.Size(ngram));
554
Host.
Assert
(Utils.Size(ngram) == ngramLength);
555
Host.
Assert
(icol >= 0);
Text\NgramTransform.cs (19)
245
env.
Assert
(srcTypes[iinfo] is VectorDataViewType vectorType && vectorType.ItemType is KeyDataViewType);
329
env.
Assert
(counts[i] >= 0);
330
env.
Assert
(counts[i] <= lims[i]);
335
env.
Assert
(count == pool.Count);
341
env.
Assert
(lims.Count > 0);
342
env.
Assert
(lims.Count == Utils.Size(counts));
349
env.
Assert
(0 < lim && lim <= Utils.Size(ngram));
350
env.
Assert
(lim <= Utils.Size(counts));
351
env.
Assert
(lim <= lims.Count);
352
env.
Assert
(icol == 0);
527
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
528
Host.
Assert
(InputSchema[_srcCols[iinfo]].HasKeyValues());
547
Host.
Assert
(n >= 0);
562
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
563
Host.
Assert
(InputSchema[_srcCols[iinfo]].HasKeyValues());
596
Host.
Assert
(n >= 0);
636
Host.
Assert
(keyCount > 0);
661
Host.
Assert
(0 < lim && lim <= Utils.Size(ngram));
662
Host.
Assert
(lim <= Utils.Size(_parent._transformInfos[iinfo].NonEmptyLevels));
Text\StopWordsRemovingTransformer.cs (8)
396
Host.
Assert
(colIndex >= 0);
405
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
795
ch.
Assert
(isBinary != isTranspose);
802
ch.
Assert
(isTranspose);
957
Host.
Assert
(_stopWordsMap.Count > 0);
962
Host.
Assert
(nstr.Id == id);
1090
Host.
Assert
(colIndex >= 0);
1099
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
Text\TextNormalizing.cs (6)
263
Host.
Assert
(colIndex >= 0);
329
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
333
Host.
Assert
(srcType.GetItemType() is TextDataViewType);
337
Host.
Assert
(vectorType.Size >= 0);
438
Host.
Assert
(i == src.Length);
442
Host.
Assert
(src.Length == len);
Text\TokenizingByCharacters.cs (3)
299
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
315
Host.
Assert
(bldr.Length == boundaries[boundaries.Length - 1]);
467
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
Text\WordEmbeddingsExtractor.cs (5)
112
ch.
Assert
(wordVector.Length == Dimension);
546
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
554
Host.
Assert
(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
557
Host.
Assert
(column.Type is VectorDataViewType);
558
Host.
Assert
(column.Type.GetItemType() is TextDataViewType);
Text\WordTokenizing.cs (3)
228
Host.
Assert
(colIndex >= 0);
237
Host.
Assert
(0 <= iinfo && iinfo < _parent._columns.Length);
242
Host.
Assert
(srcType.GetItemType() is TextDataViewType);
UngroupTransform.cs (8)
286
_ectx.
Assert
(_pivotIndex[info.Index] == -1);
403
_ectx.
Assert
(0 <= iinfo && iinfo < _infos.Length);
409
_ectx.
Assert
(0 <= col && col < _inputSchema.Count);
410
_ectx.
Assert
(_pivotIndex[col] >= 0);
421
_ectx.
Assert
(0 <= col && col < _inputSchema.Count);
513
Ch.
Assert
(_fixedSize > 0 || _sizeGetters.Length > 0);
531
Ch.
Assert
(Position < 0 || (0 <= _pivotColPosition && _pivotColPosition < _pivotColSize));
643
Ch.
Assert
(cachedPosition <= Input.Position);
Microsoft.ML.Vision (4)
DnnRetrainTransform.cs (3)
139
env.
Assert
(actualRead == fileLength);
722
Host.
Assert
(actualWritten == fileLength);
864
Host.
Assert
(type == _parent._outputTypes[iinfo].GetItemType().RawType);
ImageClassificationTrainer.cs (1)
1363
Host.
Assert
(classCount > 1);