119 references to Assert
Microsoft.Data.Analysis.Tests (1)
test\Microsoft.ML.TestFramework\GlobalBase.cs (1)
93
Contracts.
Assert
(false, "This should invoke the handler");
Microsoft.ML.AutoML (19)
API\AutoCatalog.cs (1)
758
Contracts.
Assert
(overallColumns.Count() == overallColumns.Distinct().Count(), "detect overlapping among catalogColumns, numericColumns, textColumns and excludedColumns");
AutoMLExperiment\AutoMLExperiment.cs (3)
108
Contracts.
Assert
(!double.IsNaN(value) && value > 0, "value can't be nan or non-positive");
239
Contracts.
Assert
(tuner != null, "tuner can't be null");
355
Contracts.
Assert
(_settings.MaxExperimentTimeInSeconds > 0, $"{nameof(ExperimentSettings.MaxExperimentTimeInSeconds)} must be larger than 0");
Sweepers\Parameters.cs (13)
213
Runtime.Contracts.
Assert
(args.Min < args.Max, "min must be less than max");
215
Runtime.Contracts.
Assert
(!args.LogBase || args.Min > 0, "min must be positive if log scale is used");
216
Runtime.Contracts.
Assert
(!args.LogBase || args.StepSize == null || args.StepSize > 1, "StepSize must be greater than 1 if log scale is used");
217
Runtime.Contracts.
Assert
(args.LogBase || args.StepSize == null || args.StepSize > 0, "StepSize must be greater than 0 if linear scale is used");
308
Runtime.Contracts.
Assert
(valueTyped != null, "LongValueGenerator could not normalized parameter because it is not of the correct type");
309
Runtime.Contracts.
Assert
(_args.Min <= valueTyped.Value && valueTyped.Value <= _args.Max, "Value not in correct range");
339
Runtime.Contracts.
Assert
(args.Min < args.Max, "min must be less than max");
341
Runtime.Contracts.
Assert
(!args.LogBase || args.Min > 0, "min must be positive if log scale is used");
342
Runtime.Contracts.
Assert
(!args.LogBase || args.StepSize == null || args.StepSize > 1, "StepSize must be greater than 1 if log scale is used");
343
Runtime.Contracts.
Assert
(args.LogBase || args.StepSize == null || args.StepSize > 0, "StepSize must be greater than 0 if linear scale is used");
426
Runtime.Contracts.
Assert
(valueTyped != null, "FloatValueGenerator could not normalized parameter because it is not of the correct type");
427
Runtime.Contracts.
Assert
(_args.Min <= valueTyped.Value && valueTyped.Value <= _args.Max, "Value not in correct range");
441
Runtime.Contracts.
Assert
(valueTyped != null, "Parameter should be of type FloatParameterValue");
Sweepers\SmacSweeper.cs (2)
125
Runtime.Contracts.
Assert
(data.GetRowCount() == targets.Length, "This data view will have as many rows as there have been evaluations");
301
Runtime.Contracts.
Assert
(parameterNumeric != null, "SMAC sweeper can only sweep over discrete and numeric parameters");
Microsoft.ML.Core (22)
Data\IFileHandle.cs (3)
113
Contracts.
Assert
(false, "Closing a SimpleFileHandle write stream failed!");
128
Contracts.
Assert
(false, "Closing a SimpleFileHandle read stream failed!");
145
Contracts.
Assert
(false, "Deleting a SimpleFileHandle physical file failed!");
Data\RoleMappedSchema.cs (1)
170
Contracts.
Assert
(!schema[info.Index].IsHidden, "How did a hidden column sneak in?");
Utilities\BigArray.cs (1)
93
Contracts.
Assert
(BlockSize > 1 && (BlockSize & (BlockSize - 1)) == 0, "Block size is not a power of two.");
Utilities\BitUtils.cs (3)
177
Contracts.
Assert
(0 <= ibit && ibit < CbitUint, "UMaskBelow is designed to work for 0 <= ibit < 32");
184
Contracts.
Assert
(0 <= ibit && ibit < CbitUlong, "UMaskBelowEx is designed to work for 0 <= ibit < 64");
193
Contracts.
Assert
(0 <= ibit && ibit < CbitUlong, "UuMaskBelow is designed to work for 0 <= ibit < 64");
Utilities\Contracts.cs (1)
74
Contracts.
Assert
(false, "Format string arg mismatch: " + ex.Message);
Utilities\FixedSizeQueue.cs (5)
25
Contracts.
Assert
(capacity > 0, "Array capacity should be greater than zero");
96
Contracts.
Assert
(_count != 0, "Array is empty");
103
Contracts.
Assert
(_count != 0, "Array is empty");
110
Contracts.
Assert
(_count != 0, "Array is empty");
122
Contracts.
Assert
(_count != 0, "Array is empty");
Utilities\HybridMemoryStream.cs (1)
175
Contracts.
Assert
(tmp, "TryGetBuffer failed in HybridMemoryStream");
Utilities\MathUtils.cs (1)
26
Contracts.
Assert
(false, "Bad use of ToFloat");
Utilities\MatrixTransposeOps.cs (2)
33
Contracts.
Assert
(src != dst, "Transpose in place not supported");
84
Contracts.
Assert
(src != dst, "Transpose in place not supported");
Utilities\Stream.cs (1)
695
Contracts.
Assert
(maxChunkSizeInElements > 0, "Unexpectedly large T.");
Utilities\SupervisedBinFinder.cs (2)
108
Contracts.
Assert
(boundaries.Length == 1 && boundaries[0] == 0 || boundaries[0] > 0, "boundaries are exclusive, can't have 0");
186
Contracts.
Assert
(boundaries.Length == 1 && boundaries[0] == 0 || boundaries[0] > 0, "boundaries are exclusive, can't have 0");
Utilities\Utils.cs (1)
721
Contracts.
Assert
(length >= 0, "Length can't be negative");
Microsoft.ML.Data (22)
Commands\ShowSchemaCommand.cs (2)
160
Contracts.
Assert
(false, "Unexpected slot names type");
166
Contracts.
Assert
(false, "Unexpected length of slot names vector");
DataLoadSave\Binary\Codecs.cs (11)
490
Contracts.
Assert
(0 < _remaining, "already consumed all values");
500
Contracts.
Assert
(0 <= _currentIndex, "have not moved in");
519
Contracts.
Assert
(false, "This older form only supports reading");
543
Contracts.
Assert
(0 < _remaining, "already consumed all values");
553
Contracts.
Assert
(0 <= _currentSlot, "have not moved in");
629
Contracts.
Assert
(_remaining > 0, "already consumed all values");
679
Contracts.
Assert
(_offsets != null, "writer was already committed");
692
Contracts.
Assert
(_offsets != null, "writer was already committed");
894
Contracts.
Assert
(tmp, "TryGetBuffer failed in VBufferCodec!");
1066
Contracts.
Assert
(_vectorIndex < _numVectors - 1, "already consumed all vectors");
1086
Contracts.
Assert
(_vectorIndex >= 0, "have not moved in");
DataLoadSave\Text\TextLoaderCursor.cs (1)
829
Contracts.
Assert
(batch.Total == _total + 1, $"batch.Total:{batch.Total} while _total + 1:{_total + 1}.");
DataLoadSave\Text\TextLoaderParser.cs (1)
737
Contracts.
Assert
(parent._inputSize == 0, "Why is this being called when inputSize is known?");
DataView\DataViewConstructionUtils.cs (1)
774
Contracts.
Assert
(_current != null, "The current object must be set prior to cursoring");
DataView\DataViewExtensions.cs (2)
26
Contracts.
Assert
(dv.Schema[col.Index].Equals(col), $"The requested column named: {col.Name}, with index: {col.Index} and type: {col.Type}" +
41
Contracts.
Assert
(dv.Schema[columnNeeded.Index].Equals(columnNeeded), $"The requested column named: {columnNeeded.Name}, with index: {columnNeeded.Index} and type: {columnNeeded.Type}" +
Deprecated\Vector\GenericSpanSortHelper.cs (1)
50
Contracts.
Assert
(index >= 0 && length >= 0 && (keys.Length - index >= length), "Check the arguments in the caller!");
EntryPoints\EntryPointNode.cs (1)
197
Contracts.
Assert
(false, "Unexpected type for array variable");
Transforms\Hashing.cs (2)
1208
Contracts.
Assert
(false, "this should have never happened.");
1272
Contracts.
Assert
(false, "this should have never happened.");
Microsoft.ML.EntryPoints (5)
PermutationFeatureImportance.cs (5)
30
Contracts.
Assert
(predictor != null, "No predictor found in model");
105
Contracts.
Assert
(slotNames.Length == permutationMetrics.Length,
162
Contracts.
Assert
(slotNames.Length == permutationMetrics.Length,
221
Contracts.
Assert
(slotNames.Length == permutationMetrics.Length,
275
Contracts.
Assert
(slotNames.Length == permutationMetrics.Length,
Microsoft.ML.FastTree (3)
BinFile\BinFinder.cs (2)
155
Contracts.
Assert
(bad == 0, "distinctValues passed to FindBinsFromDistinctCounts contains non-finite values");
156
Contracts.
Assert
(inv == 0, "distinctValues passed to FindBinsFromDistinctCounts is not sorted");
TreeEnsemble\InternalRegressionTree.cs (1)
337
CheckValid((t, s) => Contracts.
Assert
(t, s));
Microsoft.ML.KMeansClustering (5)
KMeansPlusPlusTrainer.cs (5)
579
Contracts.
Assert
(_acceleratedRowMap.MaxInstancesToAccelerate >= 0,
621
Contracts.
Assert
(0 <= bestCluster && bestCluster < _clusterDistances.GetLength(1), "bestCluster must be between 0..clusterCount-1");
638
Contracts.
Assert
(0 <= newClusterIdxWithinSample && newClusterIdxWithinSample < _clusterDistances.GetLength(0), "newClusterIdxWithinSample must be between 0..numSamplesPerRound-1");
654
Contracts.
Assert
(0 <= newClusterIdxWithinSample && newClusterIdxWithinSample < _clusterDistances.GetLength(0),
656
Contracts.
Assert
((_clusterDistances == null) || (bestOldCluster == -1 ||
Microsoft.ML.StandardTrainers (3)
Optimizer\SgdOptimizer.cs (1)
398
Contracts.
Assert
(x.Length == xprev.Length, "Vectors must have the same dimensionality.");
Standard\SdcaBinary.cs (2)
324
Contracts.
Assert
(predictor == null, "SDCA based trainers don't support continuous training.");
580
Contracts.
Assert
(0 <= longIdx && longIdx < invariants.Length, $"longIdx={longIdx}, invariants.Length={invariants.Length}");
Microsoft.ML.TestFramework (4)
BaseTestBaseline.cs (3)
218
Contracts.
Assert
(!_normal, "Done() should only be called once!");
411
Contracts.
Assert
(!Path.IsPathRooted(name), "file name should not be a full path");
412
Contracts.
Assert
(!Path.IsPathRooted(nameBase), "file nameBase should not be a full path");
GlobalBase.cs (1)
93
Contracts.
Assert
(false, "This should invoke the handler");
Microsoft.ML.TorchSharp (3)
AutoFormerV2\ObjectDetectionTrainer.cs (1)
398
Contracts.
Assert
(boxValues.Length == labelValues.Length * 4, "Must have 4 coordinates for each label");
NasBert\NasBertTrainer.cs (1)
173
Contracts.
Assert
(BertOptions.TaskType != BertTaskType.None, "BertTaskType must be specified");
Utils\DataUtils.cs (1)
21
Contracts.
Assert
(values.All(v => v.dim() == 1), "All tensors should be 1D to collate.");
Microsoft.ML.Transforms (31)
Expression\BuiltinFunctions.cs (3)
42
Contracts.
Assert
(type == typeof(BL) || type == typeof(I4) || type == typeof(I8) || type == typeof(TX),
56
Contracts.
Assert
(false, "Unexpected constant value type!");
405
Contracts.
Assert
(false, "Unexpected return type!");
Expression\CodeGen.cs (20)
170
Contracts.
Assert
(false, "Unexpected src kind in DoConvert");
207
Contracts.
Assert
(false, "Unexpected dst kind in DoConvert");
316
Contracts.
Assert
(false, "Bad NumLitNode");
411
Contracts.
Assert
(false, "Bad unary op");
432
Contracts.
Assert
(false, "Bad operand type in unary minus");
470
Contracts.
Assert
(false, "Bad binary op");
547
Contracts.
Assert
(false, "Bad numeric bin op");
578
Contracts.
Assert
(false, "Bad numeric bin op");
609
Contracts.
Assert
(false, "Bad numeric bin op");
641
Contracts.
Assert
(false, "Bad numeric bin op");
776
Contracts.
Assert
(false, "Bad bool compare op");
1044
Contracts.
Assert
(false, "Bad expr kind in GenBrNa");
1058
Contracts.
Assert
(false, "Bad bool compare op");
1078
Contracts.
Assert
(false, "Bad compare op");
1110
Contracts.
Assert
(false, "Bad compare op");
1139
Contracts.
Assert
(false, "Bad bool compare op");
1157
Contracts.
Assert
(false, "Bad bool compare op");
1176
Contracts.
Assert
(false, "Bad compare op");
1205
Contracts.
Assert
(false, "Bad compare op");
1243
Contracts.
Assert
(false, "Bad function");
Expression\KeyWordTable.cs (1)
84
Contracts.
Assert
(false, "duplicate punctuator!");
Expression\Printer.cs (2)
100
Contracts.
Assert
(false, "Unexpected node kind in GetPrec - should only see ExprNode kinds");
239
Contracts.
Assert
(false, "Unknown type");
Expression\TokenCursor.cs (1)
139
Contracts.
Assert
(false, "Token stream should end with an Eof token!");
Expression\TokKind.cs (1)
165
Contracts.
Assert
(false, "Unknown error id: " + eid);
PermutationFeatureImportanceExtensions.cs (1)
469
Contracts.
Assert
(a.TopKPredictionCount == b.TopKPredictionCount, "TopK to compare must be the same length.");
Text\TextFeaturizingEstimator.cs (2)
335
Contracts.
Assert
(false, "Unexpected normalizer type");
498
Contracts.
Assert
(wordTokCols != null, "StopWords transform requires that word tokenization has been applied to the input text.");
Microsoft.ML.Vision (1)
ImageClassificationTrainer.cs (1)
714
Contracts.
Assert
(!generateValidationSet, "Validation set needed but cannot generate.");