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