7248 references to Contracts
Microsoft.Data.Analysis.Tests (5)
test\Microsoft.ML.TestFramework\GlobalBase.cs (5)
25var prev = Contracts.SetAssertHandler(AssertHandler); 26Contracts.Check(prev == null, "Expected to replace null assertion handler!"); 64var prev = Contracts.SetAssertHandler(null); 65Contracts.Check(prev == AssertHandler, "Expected to replace Global.AssertHandler!"); 93Contracts.Assert(false, "This should invoke the handler");
Microsoft.ML.AutoML (43)
API\AutoCatalog.cs (11)
644Contracts.CheckValue(inputColumnNames, nameof(inputColumnNames)); 645Contracts.CheckValue(outputColumnNames, nameof(outputColumnNames)); 646Contracts.Check(outputColumnNames.Count() == inputColumnNames.Count() && outputColumnNames.Count() > 0, "outputColumnNames and inputColumnNames must have the same length and greater than 0"); 665Contracts.CheckValue(inputColumnNames, nameof(inputColumnNames)); 666Contracts.CheckValue(outputColumnNames, nameof(outputColumnNames)); 667Contracts.Check(outputColumnNames.Count() == inputColumnNames.Count() && outputColumnNames.Count() > 0, "outputColumnNames and inputColumnNames must have the same length and greater than 0"); 686Contracts.Check(outputColumnNames.Count() == inputColumnNames.Count() && outputColumnNames.Count() > 0, "outputColumnNames and inputColumnNames must have the same length and greater than 0"); 749Contracts.CheckValue(data, nameof(data)); 758Contracts.Assert(overallColumns.Count() == overallColumns.Distinct().Count(), "detect overlapping among catalogColumns, numericColumns, textColumns and excludedColumns"); 817Contracts.CheckValue(data, nameof(data)); 818Contracts.CheckValue(columnInformation, nameof(columnInformation));
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");
Experiment\Runners\CrossValSummaryRunner.cs (4)
99Contracts.Assert(newMetrics != null); 118Contracts.Assert(newMetrics != null); 135Contracts.Assert(newMetrics != null); 149Contracts.Assert(newMetrics != null);
Sweepers\Parameters.cs (14)
129Runtime.Contracts.Assert(!float.IsNaN(value)); 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 (5)
125Runtime.Contracts.Assert(data.GetRowCount() == targets.Length, "This data view will have as many rows as there have been evaluations"); 197Runtime.Contracts.Assert(randomConfigs.Length == randomEIs.Length); 272Runtime.Contracts.Assert(pset != null); 290Runtime.Contracts.Assert(hotIndex >= 0); 301Runtime.Contracts.Assert(parameterNumeric != null, "SMAC sweeper can only sweep over discrete and numeric parameters");
Sweepers\SweeperBase.cs (1)
64Runtime.Contracts.Assert(paramSet != null);
Sweepers\SweeperProbabilityUtils.cs (5)
67Runtime.Contracts.Assert(ps.Count == sweepParams.Length); 78Runtime.Contracts.Assert(pset != null); 92Runtime.Contracts.Assert(hotIndex >= 0); 127Runtime.Contracts.Assert(array.Length == sweepParams.Length); 147Runtime.Contracts.Assert(hotIndex >= i);
Microsoft.ML.Core (1273)
CommandLine\ArgumentAttribute.cs (1)
58Contracts.Check(value == null || !(this is DefaultArgumentAttribute));
CommandLine\CharCursor.cs (5)
25Contracts.CheckValueOrNull(text); 34Contracts.CheckValueOrNull(text); 35Contracts.CheckParam(0 <= min && min <= Utils.Size(text), nameof(min)); 36Contracts.CheckParam(min <= lim && lim <= Utils.Size(text), nameof(lim)); 63Contracts.Assert(0 <= dich && dich <= _ichLim - _ichCur);
CommandLine\CmdLexer.cs (24)
80Contracts.Assert(bldr.Length > ichDst); 120Contracts.Assert(_curs.ChCur == '{'); 133Contracts.Assert(count > 0); 168Contracts.Assert(_curs.ChCur == '{'); 182Contracts.Assert(count >= 0); 215Contracts.Assert(_curs.ChCur == '\\'); 216Contracts.Assert(_escapes); 249Contracts.Assert(_curs.ChCur == '"'); 321Contracts.AssertValueOrNull(str); 329Contracts.AssertValue(sb); 330Contracts.Assert(0 <= ich && ich <= sb.Length); 346Contracts.Assert(curs.IchCur > 0 || lex.Error); 381Contracts.Assert(f == (force || curs.ChCur == '{')); 390Contracts.Assert(v.StartsWith("{") && v.EndsWith("}")); 396Contracts.Assert(!lex.Error); 397Contracts.Assert(curs.Eof); 398Contracts.Assert(str == res.ToString()); 415Contracts.Assert(ich == sb.Length); 420Contracts.Assert(ich == sb.Length); 431Contracts.AssertNonEmpty(str); 444Contracts.Assert(curs.IchCur > 0 || lex.Error); 467Contracts.AssertNonEmpty(str); 517Contracts.Assert(ichMin >= 0 && _str[ichMin] == '\\'); 518Contracts.Assert(ichMin == 0 || _str[ichMin - 1] != '\\');
CommandLine\CmdParser.cs (63)
238Contracts.CheckValue(env, nameof(env)); 281Contracts.CheckValue(destination, nameof(destination)); 292Contracts.CheckValue(env, nameof(env)); 430Contracts.AssertValueOrNull(reporter); 455Contracts.Assert(1 < firstNonUpper && firstNonUpper <= name.Length); 464Contracts.CheckValue(type, nameof(type)); 465Contracts.CheckParam(type.IsClass, nameof(type)); 476Contracts.Check(!field.IsStatic && !field.IsInitOnly && !field.IsLiteral); 479throw Contracts.Except($"Duplicate default argument '{def.LongName}' vs '{field.Name}'"); 497Contracts.Assert(!isDefault || nicks == null); 500throw Contracts.Except($"Duplicate name '{name}' in argument type '{type.Name}'"); 506throw Contracts.Except($"Duplicate name '{nick}' in argument type '{type.Name}'"); 530Contracts.Assert(def.ShortNames == null); 532Contracts.Assert(map.ContainsKey(name) && map[name] == def); 569Contracts.Assert(!string.IsNullOrEmpty(str)); 622Contracts.AssertValue(arg); 623Contracts.Assert(arg != info.ArgDef); 624Contracts.Assert(0 <= arg.Index && arg.Index < info.Args.Length); 1038Contracts.Assert(ich < curs.IchCur || curs.Eof); 1091Contracts.Assert(ich < curs.IchCur || curs.Eof); 1166throw Contracts.Except("Invalid Component string: mismatched braces, or empty component name."); 1179Contracts.AssertValueOrNull(first); 1191Contracts.AssertValue(info); 1192Contracts.AssertValue(args); 1206Contracts.Assert(Args.Where(a => a.Index == argument.Index).Count() == 1); 1208Contracts.AssertValue(arg); 1248Contracts.AssertValue(arg); 1254Contracts.CheckValue(type, nameof(type)); 1255Contracts.CheckValueOrNull(defaults); 1266Contracts.AssertValue(type); 1270Contracts.Assert(isGeneric); 1272Contracts.Assert(Utils.Size(genArgs) == 1); 1342Contracts.Assert(argDef == null || argDef.Index == -1); 1343Contracts.AssertValue(args); 1344Contracts.AssertValue(map); 1345Contracts.Assert(map.Count >= args.Length); 1346Contracts.Assert(args.Select((arg, index) => arg.Index == index).All(b => b)); 1365Contracts.AssertValue(type); 1374Contracts.AssertValue(type); 1383Contracts.AssertValue(sb); 1422Contracts.Assert(index >= -1); 1423Contracts.Assert(!string.IsNullOrWhiteSpace(name)); 1424Contracts.Check(nicks == null || nicks.All(nick => !string.IsNullOrWhiteSpace(nick))); 1425Contracts.AssertValueOrNull(defaults); 1426Contracts.AssertValue(attr); 1427Contracts.AssertValue(field); 1441Contracts.Assert(!IsDefault || Utils.Size(ShortNames) == 0); 1485throw Contracts.Except("Invalid argument type: '{0}'", ItemValueType.Name); 1488Contracts.Check(!IsCollection || AllowMultiple, "Collection arguments must allow multiple"); 1489Contracts.Check(!Unique || IsCollection, "Unique only applicable to collection arguments"); 1494Contracts.AssertValue(type); 1498Contracts.AssertValue(type.GenericTypeArguments); 1545Contracts.Check(_signatureType != null, "ComponentFactory Arguments need a SignatureType set."); 1682Contracts.Assert(string.IsNullOrEmpty(tag) || tag.StartsWith("[") && tag.EndsWith("]")); 1709Contracts.Assert(newValue is string || newValue == null); 1710Contracts.Assert((string)newValue != ""); 1892Contracts.Assert(type.IsEnum); 1929Contracts.Assert(success); 1966Contracts.Assert(value == null || value is Array); 2037Contracts.Assert(IsKeyValuePair(type)); 2065Contracts.Assert(value == null || value is Array); 2242Contracts.Assert(false); 2292throw Contracts.ExceptNotImpl("ComponentFactoryFactory can only create IComponentFactory<> types with 4 or less type args.");
ComponentModel\AssemblyLoadingUtils.cs (7)
23Contracts.AssertValue(env); 33Contracts.CheckNonEmpty(path, nameof(path)); 36throw Contracts.ExceptParam(nameof(path), "File does not exist at path: {0}", path); 68throw Contracts.ExceptIO(e, "Creating temp directory for extra assembly zip extraction failed: '{0}'", path); 77throw Contracts.ExceptIO(e, "Extracting extra assembly zip failed: '{0}'", path); 87Contracts.CheckValue(env, nameof(env)); 95Contracts.CheckValue(env, nameof(env));
ComponentModel\ComponentCatalog.cs (69)
202Contracts.AssertValue(attr); 203Contracts.AssertValue(attr.InstanceType); 204Contracts.AssertValue(attr.LoaderType); 205Contracts.AssertValueOrNull(attr.Summary); 206Contracts.AssertValueOrNull(attr.DocName); 207Contracts.AssertValueOrNull(attr.UserName); 208Contracts.AssertNonEmpty(attr.LoadNames); 209Contracts.Assert(getter == null || Utils.Size(attr.CtorTypes) == 0); 231Contracts.Assert(ArgType == null || CtorTypes.Length > 0 && CtorTypes[0] == ArgType); 236Contracts.Assert(Utils.Size(ctorArgs) == CtorTypes.Length + ((RequireEnvironment) ? 1 : 0)); 241Contracts.Assert(Utils.Size(ctorArgs) == 0); 252throw Contracts.Except(ex, "Error during class instantiation"); 256throw Contracts.Except("Can't instantiate class '{0}'", Type.Name); 267Contracts.CheckValue(env, nameof(env)); 289throw Contracts.Except("Loadable class '{0}' does not derive from '{1}'", LoadNames[0], typeof(TRes).FullName); 299throw Contracts.Except("Loadable class '{0}' does not derive from '{1}'", LoadNames[0], typeof(TRes).FullName); 315throw Contracts.Except("Loadable class '{0}' has ArgType '{1}', which has no suitable constructor", 343Contracts.AssertValue(method); 344Contracts.AssertValue(attribute); 357throw Contracts.Except("Method '{0}' has {1} parameters, but must have 2 or 3", method.Name, parameters.Length); 359throw Contracts.Except("Method '{0}', 1st parameter is {1}, but must be IHostEnvironment", method.Name, parameters[0].ParameterType); 363throw Contracts.Except("Method '{0}' returns {1}, but must return a class", method.Name, outputType); 407Contracts.AssertValue(interfaceType); 408Contracts.AssertNonEmpty(kind); 409Contracts.AssertValue(argumentType); 410Contracts.AssertValue(attribute); 421throw Contracts.Except("Invalid component kind: '{0}'", Kind); 425throw Contracts.Except("Component name '{0}' is not valid.", Name); 428throw Contracts.Except("Component '{0}' has an invalid alias '{1}'", Name, Aliases.First(x => !IsValidName(x))); 431throw Contracts.Except("Component '{0}' must inherit from IComponentFactory", argumentType); 496throw Contracts.Except($"Can't load type {instType}, because it has both create and constructor methods with the same visibility. Please indicate which one should be used by changing either the signature or the visibility of one of them."); 541throw Contracts.Except($"ComponentCatalog cannot map name '{name}' and SignatureType '{sigType}' to {info.Type.Name}, already mapped to {infoCur.Type.Name}."); 610throw Contracts.Except("Component signature '{0}' doesn't inherit from '{1}'", faceType, typeof(IComponentFactory)); 619throw Contracts.Except(ex, "Component type '{0}' doesn't have a default constructor", faceType); 701throw Contracts.Except( 704Contracts.Assert(getter == null && ctor == null && create == null); 733Contracts.CheckValue(typeBase, nameof(typeBase)); 734Contracts.CheckValueOrNull(typeSig); 761Contracts.CheckValue(sig, nameof(sig)); 762Contracts.CheckParam(sig.BaseType == typeof(MulticastDelegate), nameof(sig), "Must be a delegate type"); 816Contracts.CheckParam(signatureType.BaseType == typeof(MulticastDelegate), nameof(signatureType), "signatureType must be a delegate type"); 817Contracts.CheckValueOrNull(loadName); 834Contracts.CheckNonEmpty(name, nameof(name)); 841Contracts.CheckNonEmpty(kind, nameof(kind)); 842Contracts.CheckNonEmpty(alias, nameof(alias)); 852Contracts.CheckValue(argumentType, nameof(argumentType)); 861Contracts.CheckValue(interfaceType, nameof(interfaceType)); 862Contracts.CheckParam(interfaceType.IsInterface, nameof(interfaceType), "Must be interface"); 863Contracts.CheckValue(argumentType, nameof(argumentType)); 872Contracts.CheckValue(interfaceType, nameof(interfaceType)); 873Contracts.CheckParam(interfaceType.IsInterface, nameof(interfaceType), "Must be interface"); 874Contracts.CheckNonEmpty(alias, nameof(alias)); 886Contracts.CheckValue(interfaceType, nameof(interfaceType)); 887Contracts.CheckParam(interfaceType.IsInterface, nameof(interfaceType), "Must be interface"); 888Contracts.CheckNonEmpty(alias, nameof(alias)); 918Contracts.CheckNonEmpty(kind, nameof(kind)); 919Contracts.CheckParam(IsValidName(kind), nameof(kind), "Invalid component kind"); 929Contracts.CheckValue(interfaceType, nameof(interfaceType)); 936Contracts.CheckValue(signatureType, nameof(signatureType)); 966Contracts.AssertValueOrNull(name); 982throw Contracts.Except("Unknown loadable class: {0}", name).MarkSensitive(MessageSensitivity.None); 1000Contracts.CheckValue(env, nameof(env)); 1034throw Contracts.Except("Can't instantiate arguments object '{0}' for '{1}'", info.ArgType.Name, name); 1051Contracts.AssertValue(args); 1052Contracts.AssertNonEmpty(name); 1067Contracts.Assert(false); 1068throw Contracts.Except(e, "Unexpected exception thrown while parsing: " + e.Message); 1072throw Contracts.Except(errorMsg); 1092throw Contracts.Except($"An extension for '{key.AttributeType.Name}' with contract '{key.ContractName}' has already been registered in the ComponentCatalog.");
ComponentModel\LoadableClassAttribute.cs (17)
163Contracts.CheckValueOrNull(summary); 164Contracts.CheckValue(instType, nameof(instType)); 165Contracts.CheckValue(loaderType, nameof(loaderType)); 166Contracts.CheckNonEmpty(sigTypes, nameof(sigTypes)); 172throw Contracts.ExceptEmpty(nameof(loadNames), "LoadableClass loadName parameter can't be empty"); 175Contracts.CheckValue(sigType, nameof(sigTypes)); 177Contracts.CheckParam(sigType.BaseType == typeof(System.MulticastDelegate), nameof(sigTypes), "LoadableClass signature type must be a delegate type"); 180Contracts.CheckParam(meth != null, nameof(sigTypes), "LoadableClass signature type must be a delegate type"); 181Contracts.CheckParam(meth.ReturnType == typeof(void), nameof(sigTypes), "LoadableClass signature type must be a delegate type with void return"); 200throw Contracts.Except("Invalid signature parameter attributes"); 207Contracts.CheckValue(sigType, nameof(sigTypes)); 209Contracts.Check(sigType.BaseType == typeof(System.MulticastDelegate), "LoadableClass signature type must be a delegate type"); 212Contracts.CheckParam(meth != null, nameof(sigTypes), "LoadableClass signature type must be a delegate type"); 213Contracts.CheckParam(meth.ReturnType == typeof(void), nameof(sigTypes), "LoadableClass signature type must be a delegate type with void return"); 215Contracts.CheckParam(parms.Length + itypeBase == types.Length, nameof(sigTypes), "LoadableClass signatures must have the same number of parameters"); 220throw Contracts.ExceptParam(nameof(sigTypes), "Invalid signature parameter attributes"); 221Contracts.CheckParam(types[itypeBase + itype] == parm.ParameterType, nameof(sigTypes),
Data\AnnotationUtils.cs (15)
118public static Exception ExceptGetAnnotation() => Contracts.Except("Invalid call to GetAnnotation"); 130Contracts.CheckValue(getter, nameof(getter)); 144Contracts.CheckParam(size > 0, nameof(size), "must be known size"); 156Contracts.CheckParam(rangeCount > 0, nameof(rangeCount), "must be known size"); 198Contracts.CheckValue(type, nameof(type)); 300Contracts.CheckValueOrNull(schema); 301Contracts.CheckParam(vectorSize >= 0, nameof(vectorSize)); 326Contracts.CheckParam(column.IsValid, nameof(column), "struct not initialized properly"); 341Contracts.CheckParam(col.IsValid, nameof(col), "struct not initialized properly"); 360Contracts.CheckValue(schema, nameof(schema)); 361Contracts.CheckValue(type, nameof(type)); 380Contracts.CheckValue(schema, nameof(schema)); 381Contracts.Check(colIndex >= 0, nameof(colIndex)); 464Contracts.AssertValue(annotations); 497Contracts.CheckValue(annotations, nameof(annotations));
Data\ColumnTypeExtensions.cs (2)
135Contracts.Assert(false); 165Contracts.Assert(false);
Data\DataKind.cs (3)
141Contracts.Check(0 <= index && index < KindCount); 158Contracts.Check(kind != InternalDataKind.UG); 295Contracts.CheckValueOrNull(type);
Data\IEstimator.cs (10)
64Contracts.CheckNonEmpty(name, nameof(name)); 65Contracts.CheckValueOrNull(annotations); 66Contracts.CheckParam(!(itemType is KeyDataViewType), nameof(itemType), "Item type cannot be a key"); 67Contracts.CheckParam(!(itemType is VectorDataViewType), nameof(itemType), "Item type cannot be a vector"); 68Contracts.CheckParam(!isKey || KeyDataViewType.IsValidDataType(itemType.RawType), nameof(itemType), "The item type must be valid for a key"); 89Contracts.Check(source.IsValid, nameof(source)); 131Contracts.CheckValue(columns, nameof(columns)); 133Contracts.CheckParam(columns.All(c => c.IsValid), nameof(columns), "Some items are not initialized properly."); 180Contracts.CheckValue(schema, nameof(schema)); 209Contracts.CheckValue(name, nameof(name));
Data\IFileHandle.cs (7)
69Contracts.CheckValue(ectx, nameof(ectx)); 99Contracts.Assert(_streams != null); 113Contracts.Assert(false, "Closing a SimpleFileHandle write stream failed!"); 128Contracts.Assert(false, "Closing a SimpleFileHandle read stream failed!"); 133Contracts.Assert(IsDisposed); 145Contracts.Assert(false, "Deleting a SimpleFileHandle physical file failed!"); 166Contracts.Assert(_streamWrite == null);
Data\IHostEnvironment.cs (8)
38Contracts.AssertValue(env); 39Contracts.CheckNonWhiteSpace(path, nameof(path)); 48Contracts.AssertValue(env); 49Contracts.CheckNonWhiteSpace(path, nameof(path)); 225Contracts.CheckNonEmpty(message, nameof(message)); 235Contracts.CheckNonEmpty(fmt, nameof(fmt)); 236Contracts.CheckNonEmpty(args, nameof(args)); 262/// that do not belong in more specific areas, for example, <see cref="Contracts"/> or
Data\IProgressChannel.cs (2)
104Contracts.CheckValueOrNull(unitNames); 105Contracts.CheckValueOrNull(metricNames);
Data\ModelHeader.cs (76)
109Contracts.Assert(Marshal.SizeOf(typeof(ModelHeader)) == Size); 110Contracts.CheckValue(writer, nameof(writer)); 122Contracts.CheckIO(writer.FpCur() == fpMin + ModelHeader.Size); 131Contracts.CheckValue(writer, nameof(writer)); 132Contracts.CheckParam(fpMin >= 0, nameof(fpMin)); 133Contracts.CheckValueOrNull(pool); 138Contracts.Check(header.FpStringTable == 0); 139Contracts.Check(header.CbStringTable == 0); 140Contracts.Check(header.FpStringChars == 0); 141Contracts.Check(header.CbStringChars == 0); 152Contracts.Assert(ns.Id == cv); 157Contracts.Assert(cv == pool.Count); 160Contracts.Assert(header.FpStringChars == header.FpStringTable + header.CbStringTable); 167Contracts.Assert(offset == header.CbStringChars); 199Contracts.CheckValue(writer, nameof(writer)); 200Contracts.CheckParam(fpMin >= 0, nameof(fpMin)); 210Contracts.Assert(res); 211Contracts.Check(res); 218Contracts.Assert(writer.FpCur() == fpMin + ModelHeader.Size); 228Contracts.Check(header.FpModel == ModelHeader.Size); 229Contracts.Check(header.CbModel == 0); 232Contracts.Check(fpCur - fpMin >= header.FpModel); 262Contracts.Check(sig.Length <= 24); 266Contracts.Check(ch <= 0xFF); 288Contracts.Check(sig.Length <= 24); 292Contracts.Check(ch <= 0xFF); 307Contracts.Check(Utils.Size(bytes) >= Size); 326Contracts.CheckDecode(headerBytes.Length == ModelHeader.Size); 342Contracts.CheckDecode(header.FpModel + header.CbModel == reader.FpCur() - fpMin); 351Contracts.CheckDecode(header.ModelSignature == ver.ModelSignature, "Unknown file type"); 352Contracts.CheckDecode(header.ModelVerReadable <= header.ModelVerWritten, "Corrupt file header"); 354throw Contracts.ExceptDecode("Cause: ML.NET {0} cannont read component '{1}' of the model, because the model is too new.\n" + 362throw Contracts.ExceptDecode("Cause: ML.NET {0} cannot read component '{1}' of the model, because the model is too old.\n" + 374Contracts.Check(Utils.Size(bytes) >= Size); 388Contracts.Check(size >= 0); 392Contracts.CheckDecode(header.Signature == SignatureValue, "Wrong file type"); 393Contracts.CheckDecode(header.VerReadable <= header.VerWritten, "Corrupt file header"); 394Contracts.CheckDecode(header.VerReadable <= VerWrittenCur, "File is too new"); 395Contracts.CheckDecode(header.VerWritten >= VerWeCanReadBack, "File is too old"); 398Contracts.CheckDecode(header.FpModel == Size); 399Contracts.CheckDecode(header.FpModel + header.CbModel >= header.FpModel); 404Contracts.CheckDecode(header.CbStringTable == 0); 405Contracts.CheckDecode(header.FpStringChars == 0); 406Contracts.CheckDecode(header.CbStringChars == 0); 409Contracts.CheckDecode(header.FpTail == header.FpModel + header.CbModel); 415Contracts.CheckDecode(header.FpStringTable == header.FpModel + header.CbModel); 416Contracts.CheckDecode(header.CbStringTable % sizeof(long) == 0); 417Contracts.CheckDecode(header.CbStringTable / sizeof(long) < int.MaxValue); 418Contracts.CheckDecode(header.FpStringTable + header.CbStringTable > header.FpStringTable); 419Contracts.CheckDecode(header.FpStringChars == header.FpStringTable + header.CbStringTable); 420Contracts.CheckDecode(header.CbStringChars % sizeof(char) == 0); 421Contracts.CheckDecode(header.FpStringChars + header.CbStringChars >= header.FpStringChars); 424Contracts.CheckDecode(header.FpTail == header.FpStringChars + header.CbStringChars); 432Contracts.CheckDecode(header.CbAssemblyName == 0); 439Contracts.CheckDecode(header.FpAssemblyName == header.FpModel + header.CbModel); 443Contracts.CheckDecode(header.FpAssemblyName == header.FpStringChars + header.CbStringChars); 445Contracts.CheckDecode(header.CbAssemblyName % sizeof(char) == 0); 446Contracts.CheckDecode(header.FpTail == header.FpAssemblyName + header.CbAssemblyName); 450Contracts.CheckDecode(header.FpLim == header.FpTail + sizeof(ulong)); 451Contracts.CheckDecode(size == 0 || size >= header.FpLim); 468Contracts.CheckValue(reader, nameof(reader)); 469Contracts.Check(fpMin >= 0); 503Contracts.Assert(reader.FpCur() == header.FpStringTable + fpMin); 506Contracts.Assert(cstr < int.MaxValue); 508Contracts.Assert(header.FpStringChars == reader.FpCur() - fpMin); 509Contracts.CheckDecode(offsets[cstr - 1] == header.CbStringChars); 516Contracts.CheckDecode(header.FpStringChars + offset == reader.FpCur() - fpMin); 520Contracts.CheckDecode(offsetPrev <= offset && offset <= header.CbStringChars); 521Contracts.CheckDecode(offset % sizeof(char) == 0); 523Contracts.CheckDecode(cch < int.MaxValue); 530Contracts.CheckDecode(offset == header.CbStringChars); 531Contracts.CheckDecode(header.FpStringChars + header.CbStringChars == reader.FpCur() - fpMin); 551Contracts.CheckDecode(header.FpTail == reader.FpCur() - fpMin); 554Contracts.CheckDecode(tail == TailSignatureValue, "Corrupt model file tail"); 643Contracts.Check(Utils.Size(modelSignature) == 8, "Model signature must be eight characters"); 648Contracts.Check(ch <= 0xFF);
Data\ModelLoadContext.cs (3)
78Contracts.CheckValue(rep, nameof(rep)); 104Contracts.AssertValueOrNull(ectx); 153Contracts.CheckDecode(0 <= id && id < Utils.Size(Strings));
Data\ModelLoading.cs (13)
85Contracts.CheckValue(env, nameof(env)); 119Contracts.CheckValue(env, nameof(env)); 158Contracts.CheckValue(env, nameof(env)); 169Contracts.Assert(fp == ent.Stream.Position); 180Contracts.CheckValue(env, nameof(env)); 193Contracts.CheckValue(env, nameof(env)); 204Contracts.CheckValue(env, nameof(env)); 206throw Contracts.ExceptDecode("Couldn't load model"); 216Contracts.CheckValue(env, nameof(env)); 220Contracts.Assert(fp == ctx.FpMin); 231Contracts.CheckValue(env, nameof(env)); 233throw Contracts.ExceptDecode("Couldn't load model"); 295Contracts.AssertNonEmpty(args1);
Data\ModelSaveContext.cs (2)
87Contracts.CheckValue(rep, nameof(rep)); 123Contracts.AssertValueOrNull(ectx);
Data\ModelSaving.cs (2)
63Contracts.CheckValue(writer, nameof(writer)); 64Contracts.CheckValue(fn, nameof(fn));
Data\ProgressReporter.cs (21)
52Contracts.CheckValueOrNull(ectx); 115Contracts.Assert(_subChannels.Count == 0); 133Contracts.Assert(entry.Header.MetricNames.Count == 0 && entry.Header.UnitNames.Count == 0); 161Contracts.Assert(res == channel); 233Contracts.Assert(entry.Header.MetricNames.Count == 0 && entry.Header.UnitNames.Count == 0); 241Contracts.AssertValue(root); 242Contracts.Assert(level >= 0); 352Contracts.Assert(index > 0); 353Contracts.AssertNonEmpty(name); 354Contracts.AssertValue(channel); 366Contracts.CheckValue(ectx, nameof(ectx)); 525Contracts.Check(0 <= index && index < Progress.Length); 536Contracts.Check(0 <= index && index < Progress.Length); 537Contracts.Assert(0 <= index && index < Progress.Length); 547Contracts.Check(0 <= index && index < Metrics.Length); 556Contracts.CheckValue(header, nameof(header)); 588Contracts.CheckParam(index >= 0, nameof(index)); 589Contracts.CheckNonEmpty(name, nameof(name)); 590Contracts.CheckValue(entry, nameof(entry)); 602Contracts.CheckParam(index >= 0, nameof(index)); 603Contracts.CheckNonEmpty(name, nameof(name));
Data\ReadOnlyMemoryUtils.cs (6)
23Contracts.CheckValueOrNull(s); 36Contracts.CheckValueOrNull(separators); 123Contracts.CheckValueOrNull(separators); 215Contracts.CheckValue(sb, nameof(sb)); 231Contracts.Assert(j == span.Length); 239Contracts.CheckValue(sb, nameof(sb));
Data\Repository.cs (3)
110Contracts.AssertValueOrNull(ectx); 293Contracts.CheckValueOrNull(ectx); 452Contracts.CheckValueOrNull(ectx);
Data\RoleMappedSchema.cs (38)
103Contracts.CheckNonEmpty(value, nameof(value)); 159Contracts.AssertValue(schema); 160Contracts.AssertValue(map); 166Contracts.Assert(Utils.Size(kvp.Value) > 0); 170Contracts.Assert(!schema[info.Index].IsHidden, "How did a hidden column sneak in?"); 203Contracts.AssertValue(map); 204Contracts.AssertNonEmpty(role.Value); 216Contracts.AssertValue(schema); 217Contracts.AssertValue(roles); 222Contracts.AssertNonEmpty(kvp.Key.Value); 229throw Contracts.ExceptParam(nameof(schema), $"{kvp.Value} column '{kvp.Key.Value}' not found"); 307throw Contracts.Except("Expected exactly one column with role '{0}', but found {1}.", role.Value, Utils.Size(infos)); 316Contracts.Assert(Utils.Size(kvp.Value) > 0); 334: this(Contracts.CheckRef(schema, nameof(schema)), Contracts.CheckRef(roles, nameof(roles)), opt) 349: this(Contracts.CheckRef(schema, nameof(schema)), 350MapFromNames(schema, Contracts.CheckRef(roles, nameof(roles)), opt)) 392: this(Contracts.CheckRef(schema, nameof(schema)), PredefinedRolesHelper(label, feature, group, weight, name, custom), opt) 394Contracts.CheckValueOrNull(label); 395Contracts.CheckValueOrNull(feature); 396Contracts.CheckValueOrNull(group); 397Contracts.CheckValueOrNull(weight); 398Contracts.CheckValueOrNull(name); 399Contracts.CheckValueOrNull(custom); 424Contracts.AssertValue(data); 425Contracts.AssertValue(schema); 426Contracts.Assert(schema.Schema == data.Schema); 442: this(Contracts.CheckRef(data, nameof(data)), new RoleMappedSchema(data.Schema, Contracts.CheckRef(roles, nameof(roles)), opt)) 457: this(Contracts.CheckRef(data, nameof(data)), new RoleMappedSchema(data.Schema, Contracts.CheckRef(roles, nameof(roles)), opt)) 478: this(Contracts.CheckRef(data, nameof(data)), 481Contracts.CheckValueOrNull(label); 482Contracts.CheckValueOrNull(feature); 483Contracts.CheckValueOrNull(group); 484Contracts.CheckValueOrNull(weight); 485Contracts.CheckValueOrNull(name); 486Contracts.CheckValueOrNull(custom);
Data\RootCursorBase.cs (1)
40Contracts.CheckValue(provider, nameof(provider));
Data\ServerChannel.cs (6)
44Contracts.AssertValue(provider); 61Contracts.CheckValue(provider, nameof(provider)); 175Contracts.CheckValue(env, nameof(env)); 239Contracts.AssertValue(sch); 266Contracts.CheckValue(provider, nameof(provider)); 267Contracts.CheckNonWhiteSpace(identifier, nameof(identifier));
Data\SynchronizedCursorBase.cs (1)
44Contracts.AssertValue(provider);
Data\WrappingRow.cs (1)
32Contracts.AssertValue(input);
EntryPoints\EntryPointUtils.cs (4)
37Contracts.AssertValue(range); 38Contracts.AssertValue(val); 93Contracts.CheckValue(env, nameof(env)); 108Contracts.CheckValueOrNull(ectx);
EntryPoints\ModuleArgs.cs (16)
165Contracts.Check(_inf == null, 167Contracts.Check(_max == null || ((IComparable)_max).CompareTo(value) != -1, 169Contracts.Check(_sup == null || ((IComparable)_sup).CompareTo(value) == 1, 184Contracts.Check(_sup == null, 186Contracts.Check(_min == null || ((IComparable)_min).CompareTo(value) != 1, 188Contracts.Check(_inf == null || ((IComparable)_inf).CompareTo(value) == -1, 203Contracts.Check(_min == null, 205Contracts.Check(_max == null || ((IComparable)_max).CompareTo(value) == 1, 207Contracts.Check(_sup == null || ((IComparable)_sup).CompareTo(value) == 1, 222Contracts.Check(_max == null, 224Contracts.Check(_min == null || ((IComparable)_min).CompareTo(value) == -1, 226Contracts.Check(_inf == null || ((IComparable)_inf).CompareTo(value) == -1, 234Contracts.CheckValue(val, nameof(val)); 237Contracts.Check(val is IComparable, "Type for range attribute must support IComparable"); 241Contracts.Check(_type == val.GetType(), "All Range attribute values must be of the same type"); 602Contracts.AssertValue(type);
Environment\ConsoleEnvironment.cs (33)
41Contracts.AssertValue(parent); 42Contracts.AssertValue(outWriter); 43Contracts.AssertValue(errWriter); 74Contracts.Assert(msg.Kind == ChannelMessageKind.Error); 126Contracts.Assert(commChannel.Verbose); 180Contracts.AssertValue(progressTracker); 230Contracts.Assert(ev.Kind == ProgressReporting.ProgressEvent.EventKind.Progress); 231Contracts.Assert(!ev.ProgressEntry.IsCheckpoint); 371Contracts.CheckValueOrNull(outWriter); 372Contracts.CheckValueOrNull(errWriter); 396Contracts.AssertValue(rand); 397Contracts.AssertValueOrNull(parentFullName); 398Contracts.AssertNonEmpty(shortName); 399Contracts.Assert(source == this || source is Host); 405Contracts.AssertValue(parent); 406Contracts.Assert(parent is ConsoleEnvironment); 407Contracts.AssertNonEmpty(name); 413Contracts.AssertValue(parent); 414Contracts.Assert(parent is ConsoleEnvironment); 415Contracts.AssertNonEmpty(name); 425Contracts.CheckValue(newOutWriter, nameof(newOutWriter)); 426Contracts.CheckValue(newErrWriter, nameof(newErrWriter)); 443Contracts.AssertValue(env); 444Contracts.AssertValue(newOutWriter); 445Contracts.AssertValue(newErrWriter); 449Contracts.AssertValue(_oldConsoleWriter); 457Contracts.Assert(_root._consoleWriter == _newConsoleWriter); 473Contracts.AssertValue(parent); 474Contracts.Assert(parent is Host); 475Contracts.AssertNonEmpty(name); 481Contracts.AssertValue(parent); 482Contracts.Assert(parent is Host); 483Contracts.AssertNonEmpty(name);
Environment\HostEnvironmentBase.cs (22)
46Contracts.AssertValueOrNull(parentFullName); 47Contracts.AssertValueOrNull(shortName); 72Contracts.Mark(ex); 137Contracts.CheckNonEmpty(name, nameof(name)); 171Contracts.AssertValue(parent); 172Contracts.AssertValue(dispatch); 203Contracts.Mark(ex); 392Contracts.CheckValue(source, nameof(source)); 393Contracts.CheckValueOrNull(rand); 416Contracts.CheckNonEmpty(name, nameof(name)); 440Contracts.CheckNonEmpty(name, nameof(name)); 446Contracts.AssertNonEmpty(name); 447Contracts.AssertValueOrNull(host); 454Contracts.AssertValueOrNull(listenerAction); 455Contracts.AssertValue(channel); 479Contracts.Assert(dispatcher is Dispatcher<TMessage>); 499Contracts.CheckValue(listenerFunc, nameof(listenerFunc)); 506Contracts.CheckValue(listenerFunc, nameof(listenerFunc)); 510Contracts.AssertValue(typedDispatcher); 516Contracts.AssertValueOrNull(ex); 520Contracts.Mark(ex); 564Contracts.Assert(ichMin <= ichLim);
Environment\TelemetryMessage.cs (1)
66Contracts.AssertValue(exception);
Prediction\TrainContext.cs (3)
55Contracts.CheckValue(trainingSet, nameof(trainingSet)); 56Contracts.CheckValueOrNull(validationSet); 57Contracts.CheckValueOrNull(initialPredictor);
Utilities\BigArray.cs (59)
73Contracts.CheckParam(0 <= index && index < _length, nameof(index), "Index out of range."); 80Contracts.CheckParam(0 <= index && index < _length, nameof(index), "Index out of range."); 93Contracts.Assert(BlockSize > 1 && (BlockSize & (BlockSize - 1)) == 0, "Block size is not a power of two."); 95Contracts.CheckParam(size >= 0, nameof(size), "Must be non-negative."); 102Contracts.CheckParam(size <= MaxSize, nameof(size), "Size of BigArray is too large."); 104Contracts.Assert(longBlockCount <= Utils.ArrayMaxSize); 107Contracts.Assert(blockCount > 0); 108Contracts.Assert(0 < lastBlockSize && lastBlockSize <= BlockSize); 124Contracts.CheckValue(manip, nameof(manip)); 125Contracts.CheckParam(0 <= index && index < _length, nameof(index), "Index out of range."); 137Contracts.CheckValue(manip, nameof(manip)); 138Contracts.CheckParam(min >= 0, nameof(min), "Specified minimum index must be non-negative."); 139Contracts.CheckParam(lim <= _length, nameof(lim), "Specified limit index must be no more than length of the array."); 157Contracts.Assert(index == lim); 165Contracts.CheckParam(min >= 0, nameof(min), "Specified minimum index must be non-negative."); 166Contracts.CheckParam(lim <= _length, nameof(lim), "Specified limit index must be no more than length of the array."); 192Contracts.Assert(index == lim); 211Contracts.CheckParam(newLength >= 0, nameof(newLength), "Specified new size must be non-negative."); 212Contracts.CheckParam(newLength <= MaxSize, nameof(newLength), "Specified new size is too large."); 226Contracts.Assert(0 < longBlockCount && longBlockCount <= Utils.ArrayMaxSize); 229Contracts.Assert(0 < newLastBlockLength && newLastBlockLength <= BlockSize); 243Contracts.Assert(curBlockCount > 0); 246Contracts.Assert(0 < curLastBlockLength && curLastBlockLength <= curLastBlockSize && curLastBlockSize <= BlockSize); 251Contracts.Assert(newBlockCount < curBlockCount || (newBlockCount == curBlockCount && newLastBlockLength < curLastBlockLength)); 259Contracts.Assert(curBlockCount == newBlockCount); 264Contracts.Assert(_length == curLastBlockLength); 265Contracts.Assert(newLength == newLastBlockLength); 266Contracts.Assert(_entries.Length == 1); 279Contracts.Assert(newBlockCount > curBlockCount); 296Contracts.Assert(Utils.Size(_entries) == 0); 303Contracts.Assert(maMax >= 0); 304Contracts.Assert(0 < miLim && miLim <= Utils.Size(_entries[maMax])); 331Contracts.Assert(maMin <= maMax); // Could be violated if length == 0, but we already took care of this. 337Contracts.Assert(miLim - miMin == src.Length); 343Contracts.Assert((BlockSize - miMin) + miLim == src.Length); 347Contracts.Assert(_entries[maMax] == null); 362Contracts.Assert(_entries[major] == null); 366Contracts.Assert(srcSoFar < src.Length); 369Contracts.Assert(src.Length - srcSoFar == miLim); 370Contracts.Assert(_entries[maMax] == null); 389Contracts.Assert(0 <= length && length <= dst.Length); 390Contracts.Assert(idx <= Length && length <= Length - idx); 401Contracts.Assert(maMin <= maMax); // Could happen if length == 0, but we already took care of this. 406Contracts.Assert(miLim - miMin == length); 407Contracts.Assert(miLim <= Utils.Size(_entries[maMax])); 412Contracts.Assert((BlockSize - miMin) + miLim == length); 413Contracts.Assert(BlockSize <= Utils.Size(_entries[maMin])); 415Contracts.Assert(miLim <= Utils.Size(_entries[maMax])); 423Contracts.Assert(BlockSize <= Utils.Size(_entries[maMin])); 429Contracts.Assert(BlockSize <= Utils.Size(_entries[major])); 432Contracts.Assert(dstSoFar < length); 435Contracts.Assert(length - dstSoFar == miLim); 436Contracts.Assert(miLim <= Utils.Size(_entries[maMax])); 444Contracts.Assert(min >= 0); 445Contracts.Assert((min >> BlockSizeBits) < int.MaxValue); 448Contracts.Assert((long)major * BlockSize + minor == min); 453Contracts.Assert(lim > 0); 454Contracts.Assert((lim >> BlockSizeBits) < int.MaxValue); 458Contracts.Assert((long)major * BlockSize + minor == lim + 1);
Utilities\BinFinder.cs (60)
30Contracts.Check(cbin >= 2); 31Contracts.Check(numZeroes >= 0); 51Contracts.Assert(numValues == values.Count + 1); 88Contracts.Assert(_path[0] == 0); 89Contracts.Assert(_path[CountBins] == CountValues); 99Contracts.Assert(bounds[i] > bounds[i - 1]); 108Contracts.Check(cbin >= 2); 109Contracts.Check(numZeroes >= 0); 129Contracts.Assert(numValues == values.Count + 1); 166Contracts.Assert(_path[0] == 0); 167Contracts.Assert(_path[CountBins] == CountValues); 177Contracts.Assert(bounds[i] > bounds[i - 1]); 185Contracts.Check(cbin >= 2); 186Contracts.Check(numValues > cbin); 187Contracts.Check(counts.Count >= numValues); 188Contracts.Check(path.Length >= cbin + 1); 203Contracts.Assert(path[0] == 0); 204Contracts.Assert(path[CountBins] == CountValues); 216Contracts.Assert(a < b); 232Contracts.Assert(a <= ave); 245Contracts.Assert(a < b); 261Contracts.Assert(a <= ave); 331Contracts.Assert(CountValues > CountBins); 332Contracts.Assert(counts.Count == CountValues); 333Contracts.Assert(path.Length >= CountBins + 1); 362Contracts.Assert(_segmentHeap.Count > 0); 373Contracts.Assert(_path[0] == 0); 374Contracts.Assert(_path[CountBins] == CountValues); 391Contracts.Assert(min < max - 1); 434Contracts.Assert(0 <= min && min < split && split < max && max <= CountValues); 442Contracts.Assert(a < b && b < c); 482Contracts.Assert(peg.Energy >= 0); 491Contracts.Assert(pegs[peg.Index] == peg); 492Contracts.Assert(_path[peg.Index] != peg.Split); 495Contracts.Assert(FindSplitPosition(out e, _path[peg.Index - 1], _path[peg.Index + 1], peg.Index) == peg.Split); 520Contracts.Assert(peg.Energy >= 0); 568Contracts.Assert(CountBins >= 2); 569Contracts.Assert(CountValues > CountBins); 570Contracts.Assert(counts.Count == CountValues); 571Contracts.Assert(path.Length >= CountBins + 1); 611Contracts.Assert(bestWorst < EnergyType.MaxValue); 618Contracts.Assert(ccol > 0); 628Contracts.Assert(ivBase == (row - 1) * width); 651Contracts.Assert(eBest > 0); 652Contracts.Assert(0 <= colBest && colBest <= col); 665Contracts.Assert(bestWorst < EnergyType.MaxValue); 673Contracts.Assert(ccol > 0); 677Contracts.Assert(height + width == CountValues); 691Contracts.Assert(eBest < EnergyType.MaxValue); 695Contracts.Assert(height == CountBins - 1); 704Contracts.Assert(ivBase == (row - 1) * width); 706Contracts.Assert(_pathInfo[ivBase + colBest] <= colBest); 709Contracts.Assert(_path[row] < _path[row + 1]); 711Contracts.Assert(ivBase == 0); 716Contracts.Assert(d > 0); 730Contracts.Assert(0 <= row && row < CountBins - 1); 731Contracts.Assert(0 <= col && col <= _cskip); 738Contracts.Assert(0 < cbin && cbin <= span); 744Contracts.Assert(0 <= rem && rem < cbin); 755Contracts.Assert(worst >= best);
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\DoubleParser.cs (34)
94Contracts.Assert(res != Result.Empty || ((flags & OptionFlags.EmptyAsNaN) == 0 && value == 0) || Single.IsNaN(value)); 104Contracts.Assert(res != Result.Empty || ((flags & OptionFlags.EmptyAsNaN) == 0 && value == 0) || Double.IsNaN(value)); 340Contracts.Assert((long)(Double)(long)num == (long)num); 360Contracts.Assert((long)(Double)(long)num == (long)num); 390Contracts.Assert((num & TopTwoBits) != 0); 391Contracts.Assert((mul & TopBit) != 0); 413Contracts.Assert((num & TopThreeBits) != 0); 433Contracts.Assert(exp > 0); 440Contracts.Assert(exp < 0); 444Contracts.Assert(e2 > 0); 448Contracts.Assert(0 < e2 && e2 < 0x7FF); 551Contracts.Assert(0 <= ich && ich <= span.Length); 552Contracts.Assert(!neg); 553Contracts.Assert(num == 0); 554Contracts.Assert(exp == 0); 616Contracts.Assert(i < span.Length); 632Contracts.Assert(i < span.Length); 638Contracts.Assert(i < span.Length); 639Contracts.Assert(span[i] == decimalMarker); 651Contracts.Assert(i < span.Length); 664Contracts.Assert(i < span.Length); 686Contracts.Assert(i < span.Length); 705Contracts.Assert(Math.Abs(exp) < int.MaxValue); 711Contracts.Assert(i < span.Length); 934Contracts.Assert(_mpe10Man.Length == _mpe10e2.Length); 935Contracts.Assert(_mpne10Man.Length == _mpne10ne2.Length); 939Contracts.Assert(_mpe10Dbl.Length <= _mpe10Man.Length); 952Contracts.Assert(0 < e2 && e2 < 0x7FF); 957Contracts.Assert((Single)_mpe10Dbl[_mpe10Dbl.Length - 1] == Single.PositiveInfinity); 958Contracts.Assert((Single)_mpe10Dbl[_mpe10Dbl.Length - 2] < Single.PositiveInfinity); 963Contracts.Assert(_mpne10Dbl.Length <= _mpne10Man.Length); 968Contracts.Assert(0 < e2 && e2 < 0x7FF); 975Contracts.Assert((Single)(_mpne10Dbl[_mpne10Dbl.Length - 1] * two64) == 0); 976Contracts.Assert((Single)(_mpne10Dbl[_mpne10Dbl.Length - 2] * two64) > 0);
Utilities\FixedSizeQueue.cs (9)
25Contracts.Assert(capacity > 0, "Array capacity should be greater than zero"); 33Contracts.Assert(Utils.Size(_array) >= 0); 34Contracts.Assert(0 <= _startIndex && _startIndex < _array.Length); 35Contracts.Assert(0 <= _count && _count <= _array.Length); 70Contracts.Assert(index >= 0 && index < _count); 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\FloatUtils.cs (8)
65Contracts.Assert(-RawExpZero < exp && exp < RawExpInf - RawExpZero); 109Contracts.Assert((man & ~MaskMan) == MaskMan + 1); 132Contracts.Assert(Bits != 0); 159Contracts.Assert(IsFiniteNormal()); 258Contracts.Assert(-RawExpZero < exp && exp < RawExpInf - RawExpZero); 302Contracts.Assert((man & ~MaskMan) == MaskMan + 1); 325Contracts.Assert(Bits != 0); 352Contracts.Assert(IsFiniteNormal());
Utilities\FuncInstanceMethodInfo1`2.cs (18)
39Contracts.CheckParam(!GenericMethodDefinition.IsStatic, nameof(methodInfo), "Should be an instance method"); 40Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage); 60throw Contracts.ExceptParam(nameof(expression), "Unexpected expression form"); 64Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form"); 65Contracts.CheckParam(methodCallExpression.Method.Name == nameof(MethodInfo.CreateDelegate), nameof(expression), "Unexpected expression form"); 66Contracts.CheckParam(methodCallExpression.Method.GetParameters().Length == 2, nameof(expression), "Unexpected expression form"); 67Contracts.CheckParam(methodCallExpression.Method.GetParameters()[0].ParameterType == typeof(Type), nameof(expression), "Unexpected expression form"); 68Contracts.CheckParam(methodCallExpression.Method.GetParameters()[1].ParameterType == typeof(object), nameof(expression), "Unexpected expression form"); 71Contracts.CheckParam(methodCallExpression.Arguments.Count == 2, nameof(expression), "Unexpected expression form"); 72Contracts.CheckParam(methodCallExpression.Arguments[0] is ConstantExpression, nameof(expression), "Unexpected expression form"); 73Contracts.CheckParam(((ConstantExpression)methodCallExpression.Arguments[0]).Type == typeof(Type), nameof(expression), "Unexpected expression form"); 74Contracts.CheckParam((Type)((ConstantExpression)methodCallExpression.Arguments[0]).Value == typeof(Func<TResult>), nameof(expression), "Unexpected expression form"); 75Contracts.CheckParam(methodCallExpression.Arguments[1] is ParameterExpression, nameof(expression), "Unexpected expression form"); 76Contracts.CheckParam(methodCallExpression.Arguments[1] == expression.Parameters[0], nameof(expression), "Unexpected expression form"); 79Contracts.CheckParam(methodCallExpression.Object is ConstantExpression, nameof(expression), "Unexpected expression form"); 80Contracts.CheckParam(((ConstantExpression)methodCallExpression.Object).Type == typeof(MethodInfo), nameof(expression), "Unexpected expression form"); 83Contracts.CheckParam(expression.Body is UnaryExpression, nameof(expression), "Unexpected expression form"); 84Contracts.CheckParam(((UnaryExpression)expression.Body).Operand is MethodCallExpression, nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo1`3.cs (18)
40Contracts.CheckParam(!GenericMethodDefinition.IsStatic, nameof(methodInfo), "Should be an instance method"); 41Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage); 61throw Contracts.ExceptParam(nameof(expression), "Unexpected expression form"); 65Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form"); 66Contracts.CheckParam(methodCallExpression.Method.Name == nameof(MethodInfo.CreateDelegate), nameof(expression), "Unexpected expression form"); 67Contracts.CheckParam(methodCallExpression.Method.GetParameters().Length == 2, nameof(expression), "Unexpected expression form"); 68Contracts.CheckParam(methodCallExpression.Method.GetParameters()[0].ParameterType == typeof(Type), nameof(expression), "Unexpected expression form"); 69Contracts.CheckParam(methodCallExpression.Method.GetParameters()[1].ParameterType == typeof(object), nameof(expression), "Unexpected expression form"); 72Contracts.CheckParam(methodCallExpression.Arguments.Count == 2, nameof(expression), "Unexpected expression form"); 73Contracts.CheckParam(methodCallExpression.Arguments[0] is ConstantExpression, nameof(expression), "Unexpected expression form"); 74Contracts.CheckParam(((ConstantExpression)methodCallExpression.Arguments[0]).Type == typeof(Type), nameof(expression), "Unexpected expression form"); 75Contracts.CheckParam((Type)((ConstantExpression)methodCallExpression.Arguments[0]).Value == typeof(Func<T, TResult>), nameof(expression), "Unexpected expression form"); 76Contracts.CheckParam(methodCallExpression.Arguments[1] is ParameterExpression, nameof(expression), "Unexpected expression form"); 77Contracts.CheckParam(methodCallExpression.Arguments[1] == expression.Parameters[0], nameof(expression), "Unexpected expression form"); 80Contracts.CheckParam(methodCallExpression.Object is ConstantExpression, nameof(expression), "Unexpected expression form"); 81Contracts.CheckParam(((ConstantExpression)methodCallExpression.Object).Type == typeof(MethodInfo), nameof(expression), "Unexpected expression form"); 84Contracts.CheckParam(expression.Body is UnaryExpression, nameof(expression), "Unexpected expression form"); 85Contracts.CheckParam(((UnaryExpression)expression.Body).Operand is MethodCallExpression, nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo1`4.cs (18)
41Contracts.CheckParam(!GenericMethodDefinition.IsStatic, nameof(methodInfo), "Should be an instance method"); 42Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage); 62throw Contracts.ExceptParam(nameof(expression), "Unexpected expression form"); 66Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form"); 67Contracts.CheckParam(methodCallExpression.Method.Name == nameof(MethodInfo.CreateDelegate), nameof(expression), "Unexpected expression form"); 68Contracts.CheckParam(methodCallExpression.Method.GetParameters().Length == 2, nameof(expression), "Unexpected expression form"); 69Contracts.CheckParam(methodCallExpression.Method.GetParameters()[0].ParameterType == typeof(Type), nameof(expression), "Unexpected expression form"); 70Contracts.CheckParam(methodCallExpression.Method.GetParameters()[1].ParameterType == typeof(object), nameof(expression), "Unexpected expression form"); 73Contracts.CheckParam(methodCallExpression.Arguments.Count == 2, nameof(expression), "Unexpected expression form"); 74Contracts.CheckParam(methodCallExpression.Arguments[0] is ConstantExpression, nameof(expression), "Unexpected expression form"); 75Contracts.CheckParam(((ConstantExpression)methodCallExpression.Arguments[0]).Type == typeof(Type), nameof(expression), "Unexpected expression form"); 76Contracts.CheckParam((Type)((ConstantExpression)methodCallExpression.Arguments[0]).Value == typeof(Func<T1, T2, TResult>), nameof(expression), "Unexpected expression form"); 77Contracts.CheckParam(methodCallExpression.Arguments[1] is ParameterExpression, nameof(expression), "Unexpected expression form"); 78Contracts.CheckParam(methodCallExpression.Arguments[1] == expression.Parameters[0], nameof(expression), "Unexpected expression form"); 81Contracts.CheckParam(methodCallExpression.Object is ConstantExpression, nameof(expression), "Unexpected expression form"); 82Contracts.CheckParam(((ConstantExpression)methodCallExpression.Object).Type == typeof(MethodInfo), nameof(expression), "Unexpected expression form"); 85Contracts.CheckParam(expression.Body is UnaryExpression, nameof(expression), "Unexpected expression form"); 86Contracts.CheckParam(((UnaryExpression)expression.Body).Operand is MethodCallExpression, nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo2`4.cs (18)
41Contracts.CheckParam(!GenericMethodDefinition.IsStatic, nameof(methodInfo), "Should be an instance method"); 42Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage); 62throw Contracts.ExceptParam(nameof(expression), "Unexpected expression form"); 66Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form"); 67Contracts.CheckParam(methodCallExpression.Method.Name == nameof(MethodInfo.CreateDelegate), nameof(expression), "Unexpected expression form"); 68Contracts.CheckParam(methodCallExpression.Method.GetParameters().Length == 2, nameof(expression), "Unexpected expression form"); 69Contracts.CheckParam(methodCallExpression.Method.GetParameters()[0].ParameterType == typeof(Type), nameof(expression), "Unexpected expression form"); 70Contracts.CheckParam(methodCallExpression.Method.GetParameters()[1].ParameterType == typeof(object), nameof(expression), "Unexpected expression form"); 73Contracts.CheckParam(methodCallExpression.Arguments.Count == 2, nameof(expression), "Unexpected expression form"); 74Contracts.CheckParam(methodCallExpression.Arguments[0] is ConstantExpression, nameof(expression), "Unexpected expression form"); 75Contracts.CheckParam(((ConstantExpression)methodCallExpression.Arguments[0]).Type == typeof(Type), nameof(expression), "Unexpected expression form"); 76Contracts.CheckParam((Type)((ConstantExpression)methodCallExpression.Arguments[0]).Value == typeof(Func<T1, T2, TResult>), nameof(expression), "Unexpected expression form"); 77Contracts.CheckParam(methodCallExpression.Arguments[1] is ParameterExpression, nameof(expression), "Unexpected expression form"); 78Contracts.CheckParam(methodCallExpression.Arguments[1] == expression.Parameters[0], nameof(expression), "Unexpected expression form"); 81Contracts.CheckParam(methodCallExpression.Object is ConstantExpression, nameof(expression), "Unexpected expression form"); 82Contracts.CheckParam(((ConstantExpression)methodCallExpression.Object).Type == typeof(MethodInfo), nameof(expression), "Unexpected expression form"); 85Contracts.CheckParam(expression.Body is UnaryExpression, nameof(expression), "Unexpected expression form"); 86Contracts.CheckParam(((UnaryExpression)expression.Body).Operand is MethodCallExpression, nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo3`3.cs (18)
40Contracts.CheckParam(!GenericMethodDefinition.IsStatic, nameof(methodInfo), "Should be an instance method"); 41Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage); 61throw Contracts.ExceptParam(nameof(expression), "Unexpected expression form"); 65Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form"); 66Contracts.CheckParam(methodCallExpression.Method.Name == nameof(MethodInfo.CreateDelegate), nameof(expression), "Unexpected expression form"); 67Contracts.CheckParam(methodCallExpression.Method.GetParameters().Length == 2, nameof(expression), "Unexpected expression form"); 68Contracts.CheckParam(methodCallExpression.Method.GetParameters()[0].ParameterType == typeof(Type), nameof(expression), "Unexpected expression form"); 69Contracts.CheckParam(methodCallExpression.Method.GetParameters()[1].ParameterType == typeof(object), nameof(expression), "Unexpected expression form"); 72Contracts.CheckParam(methodCallExpression.Arguments.Count == 2, nameof(expression), "Unexpected expression form"); 73Contracts.CheckParam(methodCallExpression.Arguments[0] is ConstantExpression, nameof(expression), "Unexpected expression form"); 74Contracts.CheckParam(((ConstantExpression)methodCallExpression.Arguments[0]).Type == typeof(Type), nameof(expression), "Unexpected expression form"); 75Contracts.CheckParam((Type)((ConstantExpression)methodCallExpression.Arguments[0]).Value == typeof(Func<T, TResult>), nameof(expression), "Unexpected expression form"); 76Contracts.CheckParam(methodCallExpression.Arguments[1] is ParameterExpression, nameof(expression), "Unexpected expression form"); 77Contracts.CheckParam(methodCallExpression.Arguments[1] == expression.Parameters[0], nameof(expression), "Unexpected expression form"); 80Contracts.CheckParam(methodCallExpression.Object is ConstantExpression, nameof(expression), "Unexpected expression form"); 81Contracts.CheckParam(((ConstantExpression)methodCallExpression.Object).Type == typeof(MethodInfo), nameof(expression), "Unexpected expression form"); 84Contracts.CheckParam(expression.Body is UnaryExpression, nameof(expression), "Unexpected expression form"); 85Contracts.CheckParam(((UnaryExpression)expression.Body).Operand is MethodCallExpression, nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo3`4.cs (18)
41Contracts.CheckParam(!GenericMethodDefinition.IsStatic, nameof(methodInfo), "Should be an instance method"); 42Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage); 62throw Contracts.ExceptParam(nameof(expression), "Unexpected expression form"); 66Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form"); 67Contracts.CheckParam(methodCallExpression.Method.Name == nameof(MethodInfo.CreateDelegate), nameof(expression), "Unexpected expression form"); 68Contracts.CheckParam(methodCallExpression.Method.GetParameters().Length == 2, nameof(expression), "Unexpected expression form"); 69Contracts.CheckParam(methodCallExpression.Method.GetParameters()[0].ParameterType == typeof(Type), nameof(expression), "Unexpected expression form"); 70Contracts.CheckParam(methodCallExpression.Method.GetParameters()[1].ParameterType == typeof(object), nameof(expression), "Unexpected expression form"); 73Contracts.CheckParam(methodCallExpression.Arguments.Count == 2, nameof(expression), "Unexpected expression form"); 74Contracts.CheckParam(methodCallExpression.Arguments[0] is ConstantExpression, nameof(expression), "Unexpected expression form"); 75Contracts.CheckParam(((ConstantExpression)methodCallExpression.Arguments[0]).Type == typeof(Type), nameof(expression), "Unexpected expression form"); 76Contracts.CheckParam((Type)((ConstantExpression)methodCallExpression.Arguments[0]).Value == typeof(Func<T1, T2, TResult>), nameof(expression), "Unexpected expression form"); 77Contracts.CheckParam(methodCallExpression.Arguments[1] is ParameterExpression, nameof(expression), "Unexpected expression form"); 78Contracts.CheckParam(methodCallExpression.Arguments[1] == expression.Parameters[0], nameof(expression), "Unexpected expression form"); 81Contracts.CheckParam(methodCallExpression.Object is ConstantExpression, nameof(expression), "Unexpected expression form"); 82Contracts.CheckParam(((ConstantExpression)methodCallExpression.Object).Type == typeof(MethodInfo), nameof(expression), "Unexpected expression form"); 85Contracts.CheckParam(expression.Body is UnaryExpression, nameof(expression), "Unexpected expression form"); 86Contracts.CheckParam(((UnaryExpression)expression.Body).Operand is MethodCallExpression, nameof(expression), "Unexpected expression form");
Utilities\FuncMethodInfo`1.cs (3)
16Contracts.CheckValue(methodInfo, nameof(methodInfo)); 17Contracts.CheckParam(methodInfo.IsGenericMethod, nameof(methodInfo), "Should be generic but is not"); 20Contracts.CheckParam(typeof(TResult).IsAssignableFrom(GenericMethodDefinition.ReturnType), nameof(methodInfo), "Cannot be generic on return type");
Utilities\FuncMethodInfo`2.cs (3)
16Contracts.CheckValue(methodInfo, nameof(methodInfo)); 18Contracts.CheckParam(methodInfo.IsGenericMethod, nameof(methodInfo), "Should be generic but is not"); 21Contracts.CheckParam(typeof(TResult).IsAssignableFrom(GenericMethodDefinition.ReturnType), nameof(methodInfo), "Cannot be generic on return type");
Utilities\FuncMethodInfo`3.cs (3)
16Contracts.CheckValue(methodInfo, nameof(methodInfo)); 18Contracts.CheckParam(methodInfo.IsGenericMethod, nameof(methodInfo), "Should be generic but is not"); 21Contracts.CheckParam(typeof(TResult).IsAssignableFrom(GenericMethodDefinition.ReturnType), nameof(methodInfo), "Cannot be generic on return type");
Utilities\FuncMethodInfo1`1.cs (1)
33Contracts.CheckParam(GenericMethodDefinition.GetGenericArguments().Length == 1, nameof(methodInfo),
Utilities\FuncMethodInfo1`2.cs (1)
34Contracts.CheckParam(GenericMethodDefinition.GetGenericArguments().Length == 1, nameof(methodInfo),
Utilities\FuncMethodInfo1`3.cs (1)
35Contracts.CheckParam(GenericMethodDefinition.GetGenericArguments().Length == 1, nameof(methodInfo),
Utilities\FuncMethodInfo2`3.cs (1)
35Contracts.CheckParam(GenericMethodDefinition.GetGenericArguments().Length == 2, nameof(methodInfo),
Utilities\FuncMethodInfo3`2.cs (1)
34Contracts.CheckParam(GenericMethodDefinition.GetGenericArguments().Length == 3, nameof(methodInfo),
Utilities\FuncMethodInfo3`3.cs (1)
35Contracts.CheckParam(GenericMethodDefinition.GetGenericArguments().Length == 3, nameof(methodInfo),
Utilities\FuncStaticMethodInfo1`1.cs (1)
29Contracts.CheckParam(GenericMethodDefinition.IsStatic, nameof(function), "Should be a static method");
Utilities\FuncStaticMethodInfo1`2.cs (1)
30Contracts.CheckParam(GenericMethodDefinition.IsStatic, nameof(function), "Should be a static method");
Utilities\FuncStaticMethodInfo1`3.cs (1)
31Contracts.CheckParam(GenericMethodDefinition.IsStatic, nameof(function), "Should be a static method");
Utilities\FuncStaticMethodInfo2`3.cs (1)
31Contracts.CheckParam(GenericMethodDefinition.IsStatic, nameof(function), "Should be a static method");
Utilities\FuncStaticMethodInfo3`2.cs (1)
30Contracts.CheckParam(GenericMethodDefinition.IsStatic, nameof(function), "Should be a static method");
Utilities\FuncStaticMethodInfo3`3.cs (1)
31Contracts.CheckParam(GenericMethodDefinition.IsStatic, nameof(function), "Should be a static method");
Utilities\HashArray.cs (17)
62Contracts.AssertValue(_rgit); 63Contracts.AssertNonEmpty(_rgit); 65Contracts.Assert(0 <= _ct && _ct <= Utils.Size(_entries)); 69Contracts.Assert(Utils.Size(_rgit) >= _ct || Utils.Size(_rgit) == HashHelpers.MaxPrimeArrayLength); 79Contracts.Assert(0 <= it && it < _ct); 91Contracts.Assert(val != null); 100Contracts.Assert(0 <= iit && iit < _rgit.Length); 104Contracts.Assert(it < _ct); 110Contracts.Assert(it == -1); 150Contracts.Assert(val != null); 151Contracts.Assert(0 <= iit && iit < _rgit.Length); 155Contracts.Assert(_ct == Utils.Size(_entries)); 158Contracts.Assert(_ct < _entries.Length); 178Contracts.Assert(size >= _rgit.Length); 237Contracts.Check(destination.Length >= _ct); 262Contracts.Assert(0 <= min && min < MaxPrimeArrayLength); 271Contracts.Assert(false);
Utilities\Hashing.cs (27)
79Contracts.AssertValue(sb); 128Contracts.Assert((bits & 0x7) == 0); 129Contracts.Assert((uint)bits <= 24); 130Contracts.Assert(cur <= 0x00FFFFFF); 145Contracts.Assert(ch <= 0xFFFF); 158Contracts.Assert((bits & 0x7) == 0); 159Contracts.Assert((uint)bits <= 24); 160Contracts.Assert(cur <= 0x00FFFFFF); 194Contracts.Assert((bits & 0x7) == 0); 195Contracts.Assert((uint)bits <= 24); 196Contracts.Assert(cur <= 0x00FFFFFF); 218Contracts.Assert(ch <= 0x10FFFF); 232Contracts.Assert((bits & 0x7) == 0); 233Contracts.Assert((uint)bits <= 24); 234Contracts.Assert(cur <= 0x00FFFFFF); 277Contracts.Assert(0 <= ichMin && ichMin <= ichLim && ichLim <= Utils.Size(data)); 289Contracts.Assert((bits & 0x7) == 0); 290Contracts.Assert((uint)bits <= 24); 291Contracts.Assert(cur <= 0x00FFFFFF); 306Contracts.Assert(ch <= 0xFFFF); 319Contracts.Assert((bits & 0x7) == 0); 320Contracts.Assert((uint)bits <= 24); 321Contracts.Assert(cur <= 0x00FFFFFF); 335Contracts.Assert(hash == MurmurHash(seed, data.ToString().AsSpan())); 344Contracts.Check(0 <= min); 345Contracts.Check(min <= lim); 346Contracts.Check(lim <= Utils.Size(data));
Utilities\Heap.cs (31)
29Contracts.AssertValue(fnReverse); 46Contracts.AssertValue(fnReverse); 47Contracts.Assert(capacity >= 0); 59Contracts.AssertValue(_fnReverse); 60Contracts.AssertValue(_rgv); 61Contracts.Assert(_rgv.Count > 0); 103Contracts.Assert(iv > 0); 141Contracts.Check(cv > 1); 170Contracts.Assert(0 < iv && iv < _rgv.Count); 181Contracts.Assert(0 < iv && iv < _rgv.Count); 208Contracts.Assert(!InHeap); 229Contracts.AssertValue(fnReverse); 246Contracts.AssertValue(fnReverse); 247Contracts.Assert(capacity >= 0); 259Contracts.AssertValue(_fnReverse); 260Contracts.AssertValue(_rgv); 261Contracts.Assert(_rgv.Count > 0); 303Contracts.Assert(iv > 0); 311Contracts.Assert(0 < index && index < _rgv.Count); 313Contracts.Assert(result._index == index); 355Contracts.Check(iv > 0); 368Contracts.Assert(!vRes.InHeap); 380Contracts.AssertValue(item); 381Contracts.Check(!item.InHeap); 397Contracts.AssertValue(item); 398Contracts.Check(item.InHeap); 401Contracts.Check(Get(ivDst) == item); 404Contracts.Assert(ivSrc >= ivDst); 416Contracts.Assert(!item.InHeap); 421Contracts.Assert(0 < iv && iv < _rgv.Count); 432Contracts.Assert(0 < iv && iv < _rgv.Count);
Utilities\HybridMemoryStream.cs (23)
53throw Contracts.ExceptParam(nameof(maxLen), "must be in range [0,{0}]", Utils.ArrayMaxSize); 70Contracts.CheckValue(stream, nameof(stream)); 71Contracts.CheckParam(stream.CanRead, nameof(stream), "Cannot copy a stream we cannot read"); 73throw Contracts.ExceptParam(nameof(maxLen), "must be in range [0,{0}]", Utils.ArrayMaxSize); 79Contracts.CheckParam(stream.Position == 0, nameof(stream), "Should be at the head of the stream"); 100Contracts.Assert(_memStream == null); 101Contracts.Assert(_overflowStream == null); 105Contracts.Assert((_memStream == null) != (_overflowStream == null)); 106Contracts.Assert(Length <= _overflowBoundary || _overflowStream != null); 156Contracts.Check(!_disposed, "Stream already disposed"); 159Contracts.Assert(_memStream != null); 163Contracts.Check(_memStream.CanRead, "attempt to perform operation on closed stream"); 175Contracts.Assert(tmp, "TryGetBuffer failed in HybridMemoryStream"); 187Contracts.CheckParam(0 <= value, nameof(value), "cannot be negative"); 189Contracts.Check(!_disposed, "Stream already disposed"); 199Contracts.Check(!_disposed, "Stream already disposed"); 206Contracts.Check(!_disposed, "Stream already disposed"); 213Contracts.Check(!_disposed, "Stream already disposed"); 214Contracts.CheckValue(buffer, nameof(buffer)); 215Contracts.CheckParam(0 <= offset && offset <= buffer.Length, nameof(offset)); 216Contracts.CheckParam(0 <= count && count <= buffer.Length - offset, nameof(count)); 226Contracts.Check(!_disposed, "Stream already disposed"); 233Contracts.Check(!_disposed, "Stream already disposed");
Utilities\LruCache.cs (3)
33Contracts.CheckParam(size > 0, nameof(size), "Must be positive"); 47Contracts.Assert(key.GetHashCode() == node.Value.Key.GetHashCode()); 64Contracts.Assert(!_cache.ContainsKey(key));
Utilities\MathUtils.cs (40)
26Contracts.Assert(false, "Bad use of ToFloat"); 27throw Contracts.Except(); 59Contracts.CheckValue(x, nameof(x)); 60Contracts.CheckValue(y, nameof(y)); 61Contracts.Check(x.Length == y.Length, "Input and output must be same length."); 98Contracts.AssertValue(a); 112Contracts.AssertValue(a); 126Contracts.AssertValue(a); 285Contracts.Assert(FloatUtils.IsFinite(maxRelErr)); 286Contracts.Assert(FloatUtils.IsFinite(maxAbsError)); 307Contracts.CheckParam(x > 0, nameof(x), "LogGamma invalid for x <= 0"); 350Contracts.CheckParam(n >= 0, nameof(n), "LogFactorial is invalid for n < 0."); 379Contracts.CheckParam(df > 0, nameof(df), "Degrees of freedom must be positive"); 405Contracts.AssertValue(a); 406Contracts.AssertValue(b); 407Contracts.Assert(tol > 0); 436Contracts.Assert(0 <= x && x <= 1); 437Contracts.Assert(0 < a); 438Contracts.Assert(0 < b); 545Contracts.Assert(0 <= exp && exp < ExpInf); 572Contracts.Assert(0 <= n && n < ExpInf); 574Contracts.Assert(0 <= f && f < 1); 578Contracts.Assert(1 <= r && r < float.PositiveInfinity); 611Contracts.Assert(0 <= n && n < ExpInf); 613Contracts.Assert(0 <= f && f < 1); 617Contracts.Assert(1 <= r && r < float.PositiveInfinity); 651Contracts.Assert(0 <= n && n < ExpInf); 653Contracts.Assert(0 <= f && f < 1); 657Contracts.Assert(1 <= r && r < float.PositiveInfinity); 673Contracts.Assert(src.Length == dst.Length); 682Contracts.Assert(src.Length == dst.Length); 683Contracts.Assert(0 <= start && start <= end && end <= src.Length); 705Contracts.Assert(count >= 0); 706Contracts.Assert(Utils.Size(src) >= count); 718Contracts.Assert(ivMin <= ivLim); 724Contracts.Assert(!float.IsNaN(src[ivLim - 1])); 738Contracts.Assert(len > 0); 739Contracts.Assert(aIdx >= 0 && aIdx <= a.Length - len); 740Contracts.Assert(bIdx >= 0 && bIdx <= b.Length - len); 754Contracts.Assert(-1 - epsilon <= similarity && similarity <= 1 + epsilon);
Utilities\MatrixTransposeOps.cs (10)
31Contracts.AssertValue(src); 32Contracts.AssertValue(dst); 33Contracts.Assert(src != dst, "Transpose in place not supported"); 34Contracts.Assert(src.Length <= m * n); 35Contracts.Assert(dst.Length <= m * n); 82Contracts.AssertValue(src); 83Contracts.AssertValue(dst); 84Contracts.Assert(src != dst, "Transpose in place not supported"); 85Contracts.Assert(src.Length <= m * n); 86Contracts.Assert(dst.Length <= m * n);
Utilities\MinWaiter.cs (7)
58Contracts.CheckParam(waiters > 0, nameof(waiters), "Must have at least one waiter"); 78Contracts.Check(_maxWaiters > 0, "All waiters have been retired, Wait should not be called at this point"); 80Contracts.Assert(_waiters.Count < _maxWaiters); 85Contracts.Assert(_waiters.Count < _maxWaiters); 102Contracts.Check(_maxWaiters > 0, "Attempt to retire more waiters than were initially declared"); 103Contracts.Assert(_waiters.Count < _maxWaiters); 106Contracts.Assert(_maxWaiters == 0 || _waiters.Count < _maxWaiters);
Utilities\NormStr.cs (17)
31Contracts.Assert(id >= 0 || id == -1 && str.IsEmpty); 72Contracts.AssertValue(_rgins); 73Contracts.Assert(_rgins.Length == _mask + 1); 74Contracts.Assert(Utils.IsPowerOfTwo(_mask + 1)); 76Contracts.Assert(0 <= _cns && _cns <= Utils.Size(_rgns)); 77Contracts.Assert(Utils.Size(_rgns) == Utils.Size(_rgmeta)); 114Contracts.Assert(ins == -1); 137Contracts.Assert(ins == -1); 196Contracts.Assert(ins == -1); 214Contracts.Assert(str.Length >= 0); 215Contracts.Assert(Hashing.HashString(str.Span) == hash); 219Contracts.Assert(_cns == 0); 225Contracts.Assert(_cns == _rgns.Length); 230Contracts.Assert(_cns < _rgns.Length); 247Contracts.CheckParam(0 <= id && id < _cns, nameof(id)); 253Contracts.Assert(0 <= ins && ins < _cns); 254Contracts.Assert(_rgns[ins].Id == ins);
Utilities\OrderedWaiter.cs (4)
79throw Contracts.Except(_ex, "Event we were waiting on was subject to an exception"); 87throw Contracts.Except(_ex, "Event we were waiting on was subject to an exception"); 95throw Contracts.Except(_ex, "Event we were waiting on was subject to an exception"); 138Contracts.CheckValue(ex, nameof(ex));
Utilities\PathUtils.cs (2)
66Contracts.AssertNonWhiteSpace(fileName); 143throw Contracts.ExceptParam(nameof(folder), $"Failed to create folder for the provided path: {folder}. \nException: {exc.Message}");
Utilities\PlatformUtils.cs (3)
27Contracts.AssertValue(type); 28Contracts.AssertValue(typeDef); 35Contracts.AssertValue(type);
Utilities\Random.cs (6)
182Contracts.Assert(n >= 0); 188Contracts.CheckParam(maxValue >= 0, nameof(maxValue), "maxValue must be non-negative"); 193Contracts.Assert(0 <= res && (res < maxValue || res == 0)); 199Contracts.CheckParam(minValue <= maxValue, nameof(minValue), "minValue must be less than or equal to maxValue."); 207Contracts.CheckValue(buffer, nameof(buffer)); 233Contracts.Assert((uint)(float)u == u);
Utilities\ReservoirSampler.cs (11)
72Contracts.CheckValue(rnd, nameof(rnd)); 73Contracts.CheckParam(size > 0, nameof(size), "Reservoir size must be positive"); 74Contracts.CheckValue(getter, nameof(getter)); 84throw Contracts.Except("Cannot continue to sample after Lock() has been called"); 110throw Contracts.Except("Call Lock() before the call to GetSample()"); 151Contracts.CheckValue(rnd, nameof(rnd)); 152Contracts.CheckParam(size > 0, nameof(size), "Reservoir size must be positive"); 153Contracts.CheckValue(getter, nameof(getter)); 164Contracts.Check(!_locked, "Cannot continue to sample after Lock() has been called"); 195Contracts.Assert(_counts.Contains(0)); 248Contracts.Check(_locked, "Call Lock() before the call to GetSample()");
Utilities\Stats.cs (4)
24Contracts.CheckParam(rangeSize > 0, nameof(rangeSize), "rangeSize must be positive."); 29Contracts.Check(rangeSize <= (long)int.MaxValue * int.MaxValue, 79Contracts.CheckParam(alpha > 0, nameof(alpha), "alpha must be positive"); 128Contracts.Check(alphas.Length == result.Length,
Utilities\Stream.cs (75)
59Contracts.AssertValue(writer); 68Contracts.AssertValue(writer); 80Contracts.AssertValue(writer); 91Contracts.AssertValue(writer); 103Contracts.AssertValue(writer); 114Contracts.AssertValue(writer); 115Contracts.AssertValueOrNull(values); 134Contracts.AssertValue(writer); 147Contracts.AssertValue(writer); 148Contracts.AssertValueOrNull(values); 149Contracts.Assert(0 <= count && count <= Utils.Size(values)); 160Contracts.AssertValue(writer); 161Contracts.AssertValueOrNull(values); 162Contracts.Assert(0 <= count && count <= Utils.Size(values)); 172Contracts.AssertValue(writer); 184Contracts.AssertValue(writer); 185Contracts.AssertValue(values); 191Contracts.Assert(cv < count); 195Contracts.Assert(cv == count); 203Contracts.AssertValue(writer); 214Contracts.AssertValue(writer); 226Contracts.AssertValue(writer); 237Contracts.AssertValue(writer); 249Contracts.AssertValue(writer); 260Contracts.AssertValue(writer); 458Contracts.CheckDecode(b <= 1); 469Contracts.AssertValue(reader); 472Contracts.CheckDecode(size >= 0); 478Contracts.AssertValue(reader); 479Contracts.Assert(size >= 0); 492Contracts.AssertValue(reader); 493Contracts.AssertValue(array); 494Contracts.Assert(0 <= start && start < array.Length); 495Contracts.Assert(0 < count && count <= array.Length - start); 512Contracts.AssertValue(reader); 515Contracts.CheckDecode(size >= 0); 521Contracts.AssertValue(reader); 522Contracts.Assert(size >= 0); 534Contracts.AssertValue(reader); 537Contracts.CheckDecode(size >= 0); 543Contracts.AssertValue(reader); 544Contracts.Assert(size >= 0); 557Contracts.AssertValue(reader); 560Contracts.CheckDecode(size >= 0); 566Contracts.AssertValue(reader); 567Contracts.Assert(size >= 0); 580Contracts.AssertValue(reader); 583Contracts.CheckDecode(size >= 0); 589Contracts.AssertValue(reader); 590Contracts.Assert(size >= 0); 603Contracts.AssertValue(reader); 606Contracts.CheckDecode(size >= 0); 612Contracts.AssertValue(reader); 613Contracts.Assert(size >= 0); 628Contracts.AssertValue(reader); 631Contracts.CheckDecode(size >= 0); 637Contracts.AssertValue(reader); 638Contracts.Assert(size >= 0); 651Contracts.AssertValue(reader); 654Contracts.CheckDecode(size >= 0); 660Contracts.AssertValue(reader); 661Contracts.Assert(size >= 0); 666Contracts.CheckDecode(bytes.Length == size); 673Contracts.CheckDecode(numBits >= 0); 685Contracts.AssertValue(reader); 686Contracts.Assert(!destination.IsEmpty); 695Contracts.Assert(maxChunkSizeInElements > 0, "Unexpectedly large T."); 742Contracts.CheckIO(read > 0, "Unexpected failure to read"); 781throw Contracts.ExceptDecode("LEB128 encoded integer exceeded expected length"); 796Contracts.CheckValue(stream, nameof(stream)); 797Contracts.CheckParam(0 < bufferSize, nameof(bufferSize), "buffer size must be positive"); 855throw Contracts.ExceptUserArg(userArgument, exc.Message); 859throw Contracts.ExceptUserArg(userArgument, exc.Message); 863throw Contracts.ExceptUserArg(userArgument, exc.Message); 866throw Contracts.ExceptUserArg(userArgument, "Cannot find directory '{0}'.", dir);
Utilities\SubsetStream.cs (3)
43Contracts.AssertValue(stream); 44Contracts.Assert(!length.HasValue || length >= 0); 123throw Contracts.Except("cannot write {0} bytes to stream bounded at {1} bytes", count, _remaining);
Utilities\SupervisedBinFinder.cs (18)
69Contracts.Assert(_valueCount == labels.Count); 88Contracts.Assert(pair.Value >= curValue); 104Contracts.Assert(curIndex == _distinctValueCount - 1); 107Contracts.Assert(Utils.Size(boundaries) > 0); 108Contracts.Assert(boundaries.Length == 1 && boundaries[0] == 0 || boundaries[0] > 0, "boundaries are exclusive, can't have 0"); 109Contracts.Assert(boundaries[boundaries.Length - 1] == _distinctValueCount); 122Contracts.Assert(FloatUtils.IsFinite(result[i])); 147Contracts.Assert(_valueCount == labels.Count); 166Contracts.Assert(pair.Value >= curValue); 182Contracts.Assert(curIndex == _distinctValueCount - 1); 185Contracts.Assert(Utils.Size(boundaries) > 0); 186Contracts.Assert(boundaries.Length == 1 && boundaries[0] == 0 || boundaries[0] > 0, "boundaries are exclusive, can't have 0"); 187Contracts.Assert(boundaries[boundaries.Length - 1] == _distinctValueCount); 200Contracts.Assert(FloatUtils.IsFinite(result[i])); 214Contracts.Assert(result[i] > result[i - 1]); 223Contracts.Assert(result[i] > result[i - 1]); 259Contracts.Assert(leftCount + rightCount == totalCount); 337Contracts.Assert(intervals.Count == 0);
Utilities\TaskExtensions.cs (1)
16Contracts.Check(task.IsCompleted);
Utilities\TextReaderStream.cs (19)
43=> throw Contracts.ExceptNotSupp("Stream cannot determine length."); 52throw Contracts.ExceptNotSupp("Stream cannot seek."); 111Contracts.Assert(_buffCur == _buffLim); 116Contracts.Assert(_lineCur == 0); 124Contracts.AssertValue(_line); 125Contracts.Assert(_lineCur <= _line.Length); 134Contracts.Assert(0 < _buffLim && _buffLim <= _buff.Length); 141Contracts.Assert(charCount > 0); 143Contracts.Assert(0 < _buffLim && _buffLim <= _buff.Length); 145Contracts.Assert(_lineCur <= _line.Length); 150Contracts.CheckValue(buffer, nameof(buffer)); 151Contracts.CheckParam(0 <= offset && offset <= buffer.Length, nameof(offset), "invalid for this sized array"); 152Contracts.CheckParam(0 <= count && count <= buffer.Length - offset, nameof(count), "invalid for this sized array"); 159Contracts.Assert(_buffCur < _buffLim); 161Contracts.Assert(toCopy > 0); 174Contracts.Assert(_eof || _buffCur < _buffLim); 179=> throw Contracts.ExceptNotSupp("Stream cannot seek."); 182=> throw Contracts.ExceptNotSupp("Stream is not writable."); 185=> throw Contracts.ExceptNotSupp("Stream is not writable.");
Utilities\ThreadUtils.cs (2)
216Contracts.AssertNonEmpty(component); 217Contracts.AssertValue(ex);
Utilities\Tree.cs (3)
140Contracts.CheckValue(newChild, nameof(newChild)); 146Contracts.Assert(!ContainsKey(key)); 164Contracts.Assert(_parent._children.ContainsKey(Key));
Utilities\Utils.cs (106)
50Contracts.AssertValueOrNull(x); 56Contracts.AssertValueOrNull(x); 62Contracts.AssertValueOrNull(x); 68Contracts.AssertValueOrNull(x); 74Contracts.AssertValueOrNull(x); 80Contracts.AssertValueOrNull(x); 86Contracts.AssertValueOrNull(x); 92Contracts.AssertValueOrNull(x); 98Contracts.AssertValueOrNull(x); 104Contracts.AssertValueOrNull(x); 110Contracts.AssertValueOrNull(x); 116Contracts.AssertValueOrNull(x); 124Contracts.AssertValueOrNull(map); 135Contracts.AssertValueOrNull(list); 143Contracts.AssertValueOrNull(list); 151Contracts.AssertValueOrNull(set); 159Contracts.AssertValueOrNull(map); 167Contracts.AssertValueOrNull(map); 175Contracts.AssertValueOrNull(stack); 189Contracts.Assert(src != null); 190Contracts.Assert(!count.HasValue || (0 <= count && count <= src.Count)); 191Contracts.Assert(src.Count <= dst.Length); 208Contracts.AssertValue(input); 220Contracts.AssertValue(input); 232Contracts.AssertValue(input); 287Contracts.AssertValue(input); 288Contracts.Assert(0 <= min && min <= lim && lim <= input.Count); 295Contracts.Assert(minCur <= mid && mid < limCur); 302Contracts.Assert(min <= minCur && minCur <= limCur && limCur <= lim); 303Contracts.Assert(minCur == min || input[minCur - 1] < value); 304Contracts.Assert(limCur == lim || input[limCur] >= value); 306Contracts.Assert(min <= minCur && minCur == limCur && limCur <= lim); 307Contracts.Assert(minCur == min || input[minCur - 1] < value); 308Contracts.Assert(limCur == lim || input[limCur] >= value); 321Contracts.AssertValue(input); 322Contracts.Assert(0 <= min && min <= lim && lim <= input.Count); 323Contracts.Assert(!float.IsNaN(value)); 330Contracts.Assert(minCur <= mid && mid < limCur); 331Contracts.Assert(!float.IsNaN(input[mid])); 338Contracts.Assert(min <= minCur && minCur <= limCur && limCur <= lim); 339Contracts.Assert(minCur == min || input[minCur - 1] < value); 340Contracts.Assert(limCur == lim || input[limCur] >= value); 342Contracts.Assert(min <= minCur && minCur == limCur && limCur <= lim); 343Contracts.Assert(minCur == min || input[minCur - 1] < value); 344Contracts.Assert(limCur == lim || input[limCur] >= value); 357Contracts.AssertValue(input); 358Contracts.Assert(0 <= min && min <= lim && lim <= input.Length); 359Contracts.Assert(!Double.IsNaN(value)); 366Contracts.Assert(minCur <= mid && mid < limCur); 367Contracts.Assert(!Double.IsNaN(input[mid])); 374Contracts.Assert(min <= minCur && minCur <= limCur && limCur <= lim); 375Contracts.Assert(minCur == min || input[minCur - 1] < value); 376Contracts.Assert(limCur == lim || input[limCur] >= value); 378Contracts.Assert(min <= minCur && minCur == limCur && limCur <= lim); 379Contracts.Assert(minCur == min || input[minCur - 1] < value); 380Contracts.Assert(limCur == lim || input[limCur] >= value); 392Contracts.AssertValue(input); 393Contracts.Assert(0 <= min && min <= lim && lim <= input.Length); 400Contracts.Assert(minCur <= mid && mid < limCur); 407Contracts.Assert(min <= minCur && minCur <= limCur && limCur <= lim); 408Contracts.Assert(minCur == min || !func(input[minCur - 1])); 409Contracts.Assert(limCur == lim || func(input[limCur])); 411Contracts.Assert(min <= minCur && minCur == limCur && limCur <= lim); 412Contracts.Assert(minCur == min || !func(input[minCur - 1])); 413Contracts.Assert(limCur == lim || func(input[limCur])); 425Contracts.AssertValue(input); 426Contracts.Assert(0 <= min && min <= lim && lim <= input.Length); 433Contracts.Assert(minCur <= mid && mid < limCur); 440Contracts.Assert(min <= minCur && minCur <= limCur && limCur <= lim); 441Contracts.Assert(minCur == min || !func(input[minCur - 1], value)); 442Contracts.Assert(limCur == lim || func(input[limCur], value)); 444Contracts.Assert(min <= minCur && minCur == limCur && limCur <= lim); 445Contracts.Assert(minCur == min || !func(input[minCur - 1], value)); 446Contracts.Assert(limCur == lim || func(input[limCur], value)); 453Contracts.Assert(size >= 0); 463Contracts.Assert(0 <= lim && lim <= a.Length); 488Contracts.AssertValue(perm); 494Contracts.Assert(0 <= j && j < perm.Length); 495Contracts.Assert(res[j] == 0 && (j != perm[0] || i == 0)); 503Contracts.AssertValue(rand); 504Contracts.Assert(size >= 0); 547Contracts.AssertValue(rand); 700Contracts.Check(values.Length >= len); 721Contracts.Assert(length >= 0, "Length can't be negative"); 730Contracts.CheckParam(length >= 0, nameof(length)); 744Contracts.CheckParam(length >= 0, nameof(length)); 745Contracts.CheckValue(func, nameof(func)); 769Contracts.CheckValue(schema, nameof(schema)); 770Contracts.Check(schema.Count > 0, nameof(schema)); 771Contracts.CheckValue(pred, nameof(pred)); 804Contracts.CheckParam(lim >= 0, nameof(lim)); 805Contracts.CheckValue(pred, nameof(pred)); 839Contracts.CheckParam(lim >= 0, nameof(lim)); 840Contracts.CheckValue(columnsNeeded, nameof(columnsNeeded)); 848Contracts.Check(col.Index < lim); 890Contracts.Assert(nn != null || size == 0); 891Contracts.Assert((ne == null) == (size == 0)); 910Contracts.Assert(ivDst == size); 951Contracts.CheckValue(bitArray, nameof(bitArray)); 965throw Contracts.ExceptParam(nameof(func), "Cannot be generic on return type"); 1186Contracts.CheckValue(genArg, nameof(genArg)); 1187Contracts.CheckValue(func, nameof(func)); 1189Contracts.CheckParam(meth.IsGenericMethod, nameof(func), "Should be generic but is not"); 1190Contracts.CheckParam(meth.GetGenericArguments().Length == 1, nameof(func), 1269Contracts.CheckValue(predicate, nameof(predicate)); 1282Contracts.CheckValue(predicate, nameof(predicate));
Utilities\VBufferUtils.cs (53)
69Contracts.CheckParam(length >= 0, nameof(length)); 75Contracts.CheckParam(length >= 0, nameof(length)); 85Contracts.CheckValue(visitor, nameof(visitor)); 115Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality."); 116Contracts.CheckValue(visitor, nameof(visitor)); 166Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality."); 167Contracts.CheckValue(visitor, nameof(visitor)); 272Contracts.CheckValue(manip, nameof(manip)); 304Contracts.CheckParam(0 <= slot && slot < dst.Length, nameof(slot)); 305Contracts.CheckValue(manip, nameof(manip)); 306Contracts.CheckValueOrNull(pred); 370Contracts.Assert(i <= indices[i]); 401Contracts.Check(0 <= denseCount && denseCount <= dst.Length); 423Contracts.Assert(lim < denseCount); 450Contracts.CheckParam(0 < sparsityThreshold && sparsityThreshold < 1, nameof(sparsityThreshold)); 480Contracts.Assert(j < sparseCount); 487Contracts.Assert(j == sparseCount); 591Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality."); 592Contracts.CheckValue(manip, nameof(manip)); 718Contracts.Assert(newCount > 0); 719Contracts.Assert(0 < srcValues.Length && srcValues.Length <= newCount); 720Contracts.Assert(0 < dstValues.Length && dstValues.Length <= newCount); 779Contracts.Assert(sIndex >= 0); 780Contracts.Assert(sIndex == dIndex); 797Contracts.Assert(srcValues.Length == dstValues.Length); 800Contracts.Assert(srcIndices[i] == dstIndices[i]); 806Contracts.Assert(newCount > srcValues.Length); 830Contracts.Assert(dstIndices[dI] == sIndex); 850Contracts.Assert(srcIndices[sI] == bIndex); 867Contracts.Assert(false); 878Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality."); 879Contracts.CheckValue(manip, nameof(manip)); 894Contracts.Assert(srcValues.Length == src.Length); 904Contracts.Assert(0 < count && count < length); 938Contracts.Assert(srcValues.Length == src.Length); 947Contracts.Assert(0 < count && count < length); 988Contracts.Assert(dstCount > 0); 1032Contracts.Assert(srcValues.Length > 0); 1053Contracts.Assert(0 < resCount && resCount <= length); 1054Contracts.Assert(resCount <= srcValues.Length + dstCount); 1055Contracts.Assert(srcValues.Length <= resCount); 1056Contracts.Assert(dstCount <= resCount); 1077Contracts.Assert(i < length || j < length); 1107Contracts.Assert(ii == srcValues.Length && jj == dstCount); 1108Contracts.Assert(i == length && j == length); 1127Contracts.CheckValue(func, nameof(func)); 1169Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality."); 1170Contracts.CheckValue(func, nameof(func)); 1264Contracts.Assert(aIndices[aI] == bIndices[aI]); 1275Contracts.Assert(aIndices[aI] >= bIndices[bI]); 1290Contracts.Assert(bIndices[bI] >= aIndices[aI]); 1323Contracts.Assert(index == bIndices[bI]); 1353Contracts.CheckParam(0 <= length && length <= Utils.Size(src), nameof(length));
Microsoft.ML.Core.Tests (26)
UnitTests\CoreBaseTestClass.cs (11)
88Contracts.Assert(size >= 0); 90Contracts.Assert(result); 134Contracts.Assert(result); 192throw Contracts.Except("Unknown type in GetColumnComparer: '{0}'", type); 197Contracts.Assert(view1.Schema.Count == view2.Schema.Count); 246Contracts.Assert(curs1.Schema.Count == curs2.Schema.Count); 305Contracts.Assert(curs1.Position == curs2.Position); 326Contracts.Assert(curs1.Schema.Count == view2.Schema.Count); 336Contracts.Assert(curs1.IsColumnActive(curs1.Schema[col])); 346Contracts.Assert(cursors[col] != null); 380Contracts.Assert(curs1.Position == cursors[col].Position);
UnitTests\TestContracts.cs (5)
21Contracts.AssertValueOrNull(ectx); 56Helper(Contracts.NotSensitive(), MessageSensitivity.None); 57Helper(Contracts.UserSensitive(), MessageSensitivity.UserData); 58Helper(Contracts.SchemaSensitive(), MessageSensitivity.Schema); 59Helper(Contracts.UserSensitive().SchemaSensitive(), MessageSensitivity.UserData | MessageSensitivity.Schema);
UnitTests\TestVBuffer.cs (10)
325Contracts.Assert(a.Length == b.Length); 545Contracts.Assert(0 <= offset && a.Length <= b.Length - offset); 975Contracts.Assert(count <= len); 996Contracts.Assert(Utils.Size(indices) >= count); 1099Contracts.Assert(cases == Enum.GetValues(typeof(GenLogic)).Length); 1159throw Contracts.Except("Whoops, did you miss a case?"); 1161Contracts.Assert(a.Length == len); 1162Contracts.Assert(b.Length == len); 1172Contracts.AssertValue(equalityFunc); 1179Contracts.Assert(length > 0);
Microsoft.ML.Data (2832)
Commands\CrossValidationCommand.cs (1)
401Contracts.CheckValue(env, nameof(env));
Commands\DataCommand.cs (11)
79Contracts.CheckValue(env, nameof(env)); 99Contracts.CheckValue(impl, nameof(impl)); 100Contracts.AssertValue(impl.Host); 130Contracts.AssertValue(pipe); 143Contracts.AssertValue(pipe); 403Contracts.CheckValue(loader, nameof(loader)); 404Contracts.CheckValue(file, nameof(file)); 405Contracts.CheckParam(file.CanWrite, nameof(file), "Must be writable"); 418Contracts.CheckValue(loader, nameof(loader)); 419Contracts.CheckValue(stream, nameof(stream)); 420Contracts.CheckParam(stream.CanWrite, nameof(stream), "Must be writable");
Commands\EvaluateCommand.cs (3)
57Contracts.CheckValue(loadName, nameof(loadName)); 58Contracts.CheckValue(name, nameof(name)); 148Contracts.CheckValue(env, nameof(env));
Commands\SaveDataCommand.cs (3)
45Contracts.CheckNonEmpty(args.OutputDataFile, nameof(args.OutputDataFile)); 190Contracts.CheckValue(ch, nameof(ch)); 202Contracts.CheckValue(ch, nameof(ch));
Commands\SavePredictorCommand.cs (4)
60Contracts.CheckValue(env, nameof(env)); 123Contracts.CheckValue(env, nameof(env)); 145Contracts.CheckValue(ch, nameof(ch)); 209Contracts.CheckValue(env, nameof(env));
Commands\ScoreCommand.cs (6)
258Contracts.CheckValue(env, nameof(env)); 283Contracts.AssertValue(env); 306Contracts.CheckValue(environment, nameof(environment)); 307Contracts.AssertValue(mapper); 368Contracts.CheckValue(env, nameof(env)); 396Contracts.AssertValue(env);
Commands\ShowSchemaCommand.cs (37)
85Contracts.AssertValue(writer); 86Contracts.AssertValue(args); 87Contracts.AssertValue(data); 107Contracts.AssertValue(data); 119Contracts.AssertValue(writer); 120Contracts.AssertValue(args); 121Contracts.AssertValue(schema); 122Contracts.AssertValueOrNull(transposeDataView); 160Contracts.Assert(false, "Unexpected slot names type"); 166Contracts.Assert(false, "Unexpected length of slot names vector"); 185Contracts.AssertValue(itw); 186Contracts.AssertValue(schema); 187Contracts.Assert(0 <= col && col < schema.Count); 209Contracts.AssertValue(itw); 210Contracts.AssertValue(schema); 211Contracts.Assert(0 <= col && col < schema.Count); 212Contracts.AssertNonEmpty(kind); 213Contracts.AssertValue(type); 214Contracts.Assert(!(type is VectorDataViewType)); 229Contracts.AssertValue(itw); 230Contracts.AssertValue(schema); 231Contracts.Assert(0 <= col && col < schema.Count); 232Contracts.AssertNonEmpty(kind); 233Contracts.AssertValue(type); 234Contracts.Assert(!(type is VectorDataViewType)); 235Contracts.Assert(type.RawType == typeof(T)); 249Contracts.AssertValue(itw); 250Contracts.AssertValue(schema); 251Contracts.Assert(0 <= col && col < schema.Count); 252Contracts.AssertNonEmpty(kind); 253Contracts.AssertValue(type); 268Contracts.AssertValue(itw); 269Contracts.AssertValue(schema); 270Contracts.Assert(0 <= col && col < schema.Count); 271Contracts.AssertNonEmpty(kind); 272Contracts.AssertValue(type); 273Contracts.Assert(type.ItemType.RawType == typeof(T));
Commands\TrainCommand.cs (13)
213Contracts.CheckValueOrNull(ectx); 228Contracts.CheckValueOrNull(ectx); 261Contracts.CheckValue(env, nameof(env)); 287Contracts.AssertValue(env); 288Contracts.AssertValue(ch); 320Contracts.CheckValue(env, nameof(env)); 344Contracts.CheckValue(env, nameof(env)); 390Contracts.CheckValue(env, nameof(env)); 423Contracts.AssertValue(dataPipe); 433Contracts.AssertValue(dataPipe); 444Contracts.CheckValue(env, nameof(env)); 493Contracts.AssertValue(env, nameof(env)); 515Contracts.CheckValueOrNull(ectx);
Commands\TypeInfoCommand.cs (5)
37Contracts.CheckValue(env, nameof(env)); 58Contracts.AssertValueOrNull(x); 59Contracts.AssertValueOrNull(y); 67Contracts.AssertValueOrNull(obj); 142Contracts.AssertValue(ch);
Data\BufferBuilder.cs (33)
59Contracts.AssertValue(comb); 73Contracts.Assert(_count >= 0); 74Contracts.AssertValue(_values); 75Contracts.Assert(_values.Length >= _count); 76Contracts.Assert(0 <= _ifeatCur && 0 <= _cfeatCur && _ifeatCur <= _length - _cfeatCur); 79Contracts.Assert(_count == _length); 83Contracts.Assert(_indices != null || _length == 0); 84Contracts.Assert(Utils.Size(_indices) >= _count); 87Contracts.Assert(_sorted || _count > InsertThreshold); 98throw Contracts.Except($"Unrecognized type '{typeof(T)}' for default {nameof(BufferBuilder<T>)}"); 109Contracts.Assert(length > 0); 145Contracts.Assert(0 <= ifeat && 0 <= cfeat && ifeat <= _length - cfeat); 158Contracts.Assert(0 <= index && index < _cfeatCur); 174Contracts.Assert(_indices != null); 198Contracts.Assert(_sorted); 240Contracts.Assert(ivDst < 0 || _indices[ivDst] < index); 242Contracts.Assert(ivDst == _count || _indices[ivDst] > index); 262Contracts.Assert(!_sorted); 263Contracts.Assert(!_dense); 264Contracts.Assert(_count > 1); 283Contracts.Assert(ivSrc < _count && !_comb.IsDefault(_values[ivSrc])); 289Contracts.Assert(ivDst <= ivSrc); 304Contracts.Assert(0 < ivDst && ivDst <= _count); 319Contracts.Assert(!_dense); 320Contracts.Assert(_sorted); 330Contracts.Assert(ivDst > index); 333Contracts.Assert(ivDst == index); 350Contracts.Assert(0 <= index && index < _cfeatCur); 371Contracts.Assert(iv == 0 || ifeat > _indices[iv - 1]); 375Contracts.Assert(ifeat <= _indices[iv]); 395Contracts.Check(0 <= index && index <= _length - buffer.Length); 404Contracts.Assert(count == buffer.Length); 459Contracts.Assert(_count < _length);
Data\Combiner.cs (1)
40Contracts.Check(IsDefault(dst));
Data\Conversion.cs (71)
372throw Contracts.Except("No standard conversion from '{0}' to '{1}'", typeSrc, typeDst); 384Contracts.CheckValue(typeSrc, nameof(typeSrc)); 385Contracts.CheckValue(typeDst, nameof(typeDst)); 386Contracts.Check(typeSrc.RawType == typeof(TSrc)); 387Contracts.Check(typeDst.RawType == typeof(TDst)); 408throw Contracts.Except("No standard conversion from '{0}' to '{1}'", typeSrc, typeDst); 419Contracts.CheckValue(typeSrc, nameof(typeSrc)); 420Contracts.CheckValue(typeDst, nameof(typeDst)); 462Contracts.Assert(typeSrc is KeyDataViewType || typeSrc.IsStandardScalar()); 463Contracts.Assert(typeDst is KeyDataViewType || typeDst.IsStandardScalar()); 475throw Contracts.Except($"No conversion from '{type}' to {nameof(StringBuilder)}"); 483throw Contracts.Except($"No conversion from '{typeof(TSrc)}' to {nameof(StringBuilder)}"); 488Contracts.CheckValue(type, nameof(type)); 489Contracts.Check(type.RawType == typeof(TSrc), "Wrong TSrc type argument"); 515Contracts.Check(key.RawType == typeof(TSrc)); 540Contracts.CheckValue(typeDst, nameof(typeDst)); 541Contracts.CheckParam(typeDst.IsStandardScalar() || typeDst is KeyDataViewType, nameof(typeDst), 543Contracts.Check(typeDst.RawType == typeof(TDst), "Wrong TDst type parameter"); 548Contracts.Assert(_tryParseDelegates.ContainsKey(typeDst.RawType)); 554Contracts.Assert(key.RawType == typeof(TDst)); 581Contracts.Assert(key.RawType == typeof(TDst)); 607throw Contracts.Except("No standard conversion from '{0}' to '{1}'", typeof(U8), typeof(TDst)); 622Contracts.CheckValue(type, nameof(type)); 623Contracts.CheckParam(!(type is VectorDataViewType), nameof(type)); 624Contracts.CheckParam(type.RawType == typeof(T), nameof(type)); 629throw Contracts.Except("No IsDefault predicate for '{0}'", type); 639throw Contracts.Except("No IsNA predicate for '{0}'", type); 644Contracts.CheckValue(type, nameof(type)); 645Contracts.CheckParam(type.RawType == typeof(T), nameof(type)); 654Contracts.Assert(del is InPredicate<T>); 661Contracts.CheckValue(type, nameof(type)); 662Contracts.CheckParam(!(type is VectorDataViewType), nameof(type)); 668Contracts.Assert(_isDefaultDelegates.ContainsKey(t.RawType)); 677Contracts.Assert(del != null); 683Contracts.CheckValue(type, nameof(type)); 684Contracts.CheckParam(type.ItemType.RawType == typeof(T), nameof(type)); 691Contracts.Assert(_hasZeroDelegates.ContainsKey(t.RawType)); 695throw Contracts.Except("No HasMissing predicate for '{0}'", type); 707Contracts.CheckValue(type, nameof(type)); 708Contracts.CheckParam(type.RawType == typeof(T), nameof(type)); 725Contracts.CheckValue(type, nameof(type)); 726Contracts.CheckParam(type.RawType == typeof(T), nameof(type)); 742Contracts.Assert(!((InPredicate<T>)isDefPred)(in res)); 755Contracts.CheckValue(type, nameof(type)); 756Contracts.CheckParam(type.RawType == typeof(T), nameof(type)); 1088Contracts.Assert(offset == src.Length); 1103Contracts.Assert(!span.IsEmpty); 1162Contracts.Assert(max < U8.MaxValue); 1226Contracts.Assert(res.HasValue); 1227Contracts.Check((I1)res == res, "Overflow or underflow occurred while converting value in text to sbyte."); 1245Contracts.Assert(res.HasValue); 1246Contracts.Check((I2)res == res, "Overflow or underflow occurred while converting value in text to short."); 1264Contracts.Assert(res.HasValue); 1265Contracts.Check((I4)res == res, "Overflow or underflow occurred while converting value in text to int."); 1283Contracts.Assert(res.HasValue); 1297Contracts.Assert(res >= 0); 1328Contracts.Assert(max > 0); 1329Contracts.Assert((max & (max + 1)) == 0); 1346Contracts.Assert(val >= 0); 1348Contracts.Assert(long.MinValue <= result && result <= 0); 1359Contracts.Assert(sVal >= 0); 1367Contracts.Assert(0 <= result && result <= long.MaxValue); 1454Contracts.Check(res.HasValue, "Value could not be parsed from text to sbyte."); 1455Contracts.Check((I1)res == res, "Overflow or underflow occurred while converting value in text to sbyte."); 1462Contracts.Check(res.HasValue, "Value could not be parsed from text to short."); 1463Contracts.Check((I2)res == res, "Overflow or underflow occurred while converting value in text to short."); 1470Contracts.Check(res.HasValue, "Value could not be parsed from text to int."); 1471Contracts.Check((I4)res == res, "Overflow or underflow occurred while converting value in text to int."); 1478Contracts.Check(res.HasValue, "Value could not be parsed from text to long."); 1680Contracts.Assert(value.Equals(default(UG))); 1706Contracts.Assert(!value);
Data\DataViewUtils.cs (49)
29Contracts.CheckValue(schema, nameof(schema)); 53Contracts.CheckValue(schema, nameof(schema)); 54Contracts.Check(n > 0, "n"); 116Contracts.CheckValue(host, nameof(host)); 151Contracts.CheckValue(provider, nameof(provider)); 178Contracts.CheckValue(schema, nameof(schema)); 179Contracts.CheckValue(predicate, nameof(predicate)); 199Contracts.CheckValue(columnsNeeded, nameof(columnsNeeded)); 258Contracts.CheckValue(provider, nameof(provider)); 316Contracts.AssertValue(schema); 323Contracts.AssertValue(provider); 498Contracts.AssertValue(provider, "provider"); 510Contracts.AssertValue(ch); 642Contracts.AssertValue(input); 643Contracts.Assert(0 <= col && col < _schema.Count); 652Contracts.AssertValue(input); 658Contracts.Assert(0 <= poolIdx && poolIdx < _cachePools.Length); 659Contracts.AssertValue(getter); 710Contracts.AssertValue(pool); 711Contracts.AssertValue(getter); 716Contracts.AssertValueOrNull(_values); 736Contracts.AssertValue(type); 737Contracts.Assert(typeof(T) == type.RawType); 754Contracts.Assert(count > 0); 765Contracts.Assert(Utils.Size(values) >= count); 798Contracts.AssertValue(pool); 799Contracts.AssertValue(batchColumns); 800Contracts.Assert(count > 0); 801Contracts.Assert(batchId >= 0); 802Contracts.Assert(batchColumns.All(bc => bc.Count == count)); 808Contracts.Assert(!HasException); 817Contracts.AssertValue(ex); 819Contracts.Assert(HasException); 832throw Contracts.Except(_ex, "Splitter/consolidator worker encountered exception while consuming source data"); 833Contracts.Assert(Utils.Size(pipes) == _batchColumns.Length); 863Contracts.AssertValue(type); 864Contracts.AssertValue(pool); 871Contracts.Assert(type is PrimitiveDataViewType); 902Contracts.Assert(_index < _count); 913Contracts.Assert(pool is MadeObjectPool<T[]>); 919Contracts.AssertValue(getter); 920Contracts.Assert(getter is ValueGetter<T>); 926Contracts.AssertValue(batchCol); 927Contracts.Assert(batchCol is BatchColumn.Impl<T>); 931Contracts.Assert(_count == 0 || (_index == _count - 1)); 939Contracts.Assert(_count <= Utils.Size(Values)); 944Contracts.Assert(_index <= _count); 972Contracts.Check(_index < _count, "Cannot get value as the cursor is not in a good state"); 986Contracts.Check(_index < _count, "Cannot get value as the cursor is not in a good state");
Data\RowCursorUtils.cs (55)
35Contracts.CheckValue(row, nameof(row)); 36Contracts.CheckParam(0 <= col && col < row.Schema.Count, nameof(col)); 37Contracts.CheckParam(row.IsColumnActive(row.Schema[col]), nameof(col), "column was not active"); 55Contracts.CheckValue(typeDst, nameof(typeDst)); 56Contracts.CheckParam(typeDst is PrimitiveDataViewType, nameof(typeDst)); 57Contracts.CheckValue(row, nameof(row)); 58Contracts.CheckParam(0 <= col && col < row.Schema.Count, nameof(col)); 59Contracts.CheckParam(row.IsColumnActive(row.Schema[col]), nameof(col), "column was not active"); 62Contracts.Check(typeSrc is PrimitiveDataViewType, "Source column type must be primitive"); 75Contracts.CheckValue(typeDst, nameof(typeDst)); 76Contracts.CheckParam(typeDst is PrimitiveDataViewType, nameof(typeDst)); 77Contracts.CheckParam(typeDst.RawType == typeof(TDst), nameof(typeDst)); 78Contracts.CheckValue(row, nameof(row)); 79Contracts.CheckParam(0 <= col && col < row.Schema.Count, nameof(col)); 80Contracts.CheckParam(row.IsColumnActive(row.Schema[col]), nameof(col), "column was not active"); 83Contracts.Check(typeSrc is PrimitiveDataViewType, "Source column type must be primitive"); 92Contracts.Assert(typeof(TSrc) == typeSrc.RawType); 93Contracts.Assert(typeof(TDst) == typeDst.RawType); 100Contracts.Assert(typeof(TSrc) == typeof(TDst)); 123Contracts.CheckValue(row, nameof(row)); 124Contracts.CheckParam(0 <= col && col < row.Schema.Count, nameof(col)); 125Contracts.CheckParam(row.IsColumnActive(row.Schema[col]), nameof(col), "column was not active"); 128Contracts.Check(typeSrc is PrimitiveDataViewType, "Source column type must be primitive"); 134Contracts.Assert(typeof(TSrc) == typeSrc.RawType); 155Contracts.CheckValue(typeDst, nameof(typeDst)); 156Contracts.CheckValue(row, nameof(row)); 157Contracts.CheckParam(0 <= col && col < row.Schema.Count, nameof(col)); 158Contracts.CheckParam(row.IsColumnActive(row.Schema[col]), nameof(col), "column was not active"); 161Contracts.Check(typeSrc != null, "Source column type must be vector"); 174Contracts.CheckValue(typeDst, nameof(typeDst)); 175Contracts.CheckParam(typeDst.RawType == typeof(TDst), nameof(typeDst)); 176Contracts.CheckValue(row, nameof(row)); 177Contracts.CheckParam(0 <= col && col < row.Schema.Count, nameof(col)); 178Contracts.CheckParam(row.IsColumnActive(row.Schema[col]), nameof(col), "column was not active"); 181Contracts.Check(typeSrc != null, "Source column type must be vector"); 195Contracts.CheckValue(typeDst, nameof(typeDst)); 196Contracts.CheckParam(typeDst.RawType == typeof(TDst), nameof(typeDst)); 257Contracts.Assert(typeof(TSrc) == typeSrc.ItemType.RawType); 258Contracts.Assert(typeof(TDst) == typeDst.RawType); 259Contracts.AssertValue(getterFact); 266Contracts.Assert(typeof(TSrc) == typeof(TDst)); 276Contracts.Check(src.Length == size); 306Contracts.CheckValue(cursor, nameof(cursor)); 307Contracts.Check(0 <= col && col < cursor.Schema.Count); 309Contracts.Check(type is KeyDataViewType); 378Contracts.Assert(type != NumberDataViewType.Single && type != NumberDataViewType.Double); 394throw Contracts.Except("Only floating point number, boolean, and key type values can be used as label."); 396Contracts.Assert(TestGetLabelGetter(type) == null); 423throw Contracts.Except("Only floating point number, boolean, and key type values can be used as label."); 425Contracts.Assert(TestGetLabelGetter(type) == null); 475Contracts.CheckValue(env, nameof(env)); 491Contracts.CheckValue(columnsNeeded, nameof(columnsNeeded)); 492Contracts.CheckValue(sourceSchema, nameof(sourceSchema)); 499throw Contracts.Except($"The requested column: {col} is not part of the {nameof(sourceSchema)}"); 517Contracts.AssertValue(env);
Data\SchemaDefinition.cs (20)
31throw Contracts.ExceptNotSupp("Using KeyType without the Count parameter is not supported"); 78Contracts.CheckParam(size >= 0, nameof(size), "Should be non-negative number"); 93Contracts.CheckParam(size >= 0, nameof(dimensions), "Should contain only non-negative values"); 154Contracts.AssertValueOrNull(ectx); 195Contracts.Assert(false); 196throw Contracts.ExceptNotSupp("Expected a FieldInfo or a PropertyInfo"); 241Contracts.CheckNonEmpty(memberName, nameof(memberName)); 259Contracts.CheckValue(kind, nameof(kind)); 260Contracts.CheckValue(annotationType, nameof(annotationType)); 263throw Contracts.Except("Column already contains an annotation of this kind."); 307Contracts.CheckValue(value, nameof(value)); 310throw Contracts.ExceptParam(nameof(columnName), 335Contracts.CheckValue(userType, nameof(userType)); 372Contracts.Assert(false); 373throw Contracts.ExceptNotSupp("Expected a FieldInfo or a PropertyInfo"); 393throw Contracts.ExceptParam(nameof(userType), "Member {0} cannot be marked with multiple attributes, {1}, derived from {2}.", 407throw Contracts.ExceptParam(nameof(userType), "Duplicate column name '{0}' detected, this is disallowed", name); 441throw Contracts.ExceptParam(nameof(userType), "Member {0} marked with KeyType attribute, but does not appear to be a valid kind of data for a key type", memberInfo.Name); 452throw Contracts.ExceptParam(nameof(userType), $"Member {memberInfo.Name} marked with {nameof(VectorTypeAttribute)}, but does not appear to be a vector type", memberInfo.Name); 457throw Contracts.ExceptParam(nameof(userType), "Some of member {0}'s dimension lengths are negative");
Data\SlotCursor.cs (2)
32Contracts.AssertValue(provider); 89Contracts.AssertValue(cursor);
DataDebuggerPreview.cs (2)
33Contracts.CheckValue(data, nameof(data)); 34Contracts.CheckParam(maxRows >= 0, nameof(maxRows));
DataLoadSave\Binary\BinaryLoader.cs (61)
142Contracts.AssertValue(parent, "parent"); 143Contracts.AssertValue(parent._host, "parent"); 177Contracts.AssertValue(parent, "parent"); 178Contracts.AssertValue(parent._host, "parent"); 483Contracts.AssertValue(parent, "Parent"); 484Contracts.AssertValue(parent._host, "parent"); 485Contracts.AssertNonEmpty(kind); 486Contracts.Assert(Header.HeaderSize <= blockOffset); 487Contracts.Assert(0 <= blockSize); 499Contracts.AssertValue(parent, "parent"); 500Contracts.AssertValue(parent._host, "parent"); 530Contracts.Assert((codec == null) || !Enum.IsDefined(typeof(CompressionKind), compression)); 600Contracts.AssertValue(codec); 765Contracts.AssertValue(host, "host"); 825Contracts.AssertValue(host, "host"); 885Contracts.CheckValue(env, nameof(env)); 921Contracts.CheckValue(env, nameof(env)); 928Contracts.CheckValue(files, nameof(files)); 929Contracts.CheckParam(files.Count == 1, nameof(files), "binary loader must be created with one file"); 935Contracts.CheckNonEmpty(filename, nameof(filename)); 965Contracts.Assert(threads >= 0); 967Contracts.Assert(0 <= shuffleBlocks); 977Contracts.AssertValue(env, "env"); 1009Contracts.CheckValue(env, nameof(env)); 1366Contracts.Assert(ex.CancellationToken == _exMarshaller.Token); 1368Contracts.Assert(false); 1451Contracts.AssertValue(parent); 1453Contracts.AssertValue(entry); 1462Contracts.AssertValue(parent); 1538Contracts.Assert(blockSequence >= 0); 1539Contracts.Assert(0 <= min && min <= lim); 1540Contracts.Assert(lim - min <= int.MaxValue); 1544Contracts.Assert(!IsSentinel); 1553Contracts.Assert(blockSequence >= 0); 1556Contracts.Assert(IsSentinel); 1563Contracts.AssertValue(parent); 1564Contracts.AssertValue(parent.Ch); 1720Contracts.AssertValueOrNull(buffer); 1721Contracts.Assert(decompressedLength > 0); 1722Contracts.Assert(blockIndex >= 0); 1723Contracts.Assert(blockSequence >= 0); 1724Contracts.Assert(rows >= 0); 1731Contracts.Assert(!IsSentinel); 1740Contracts.Assert(blockSequence >= 0); 1743Contracts.Assert(IsSentinel); 1756Contracts.AssertValue(reader); 1757Contracts.AssertValue(stream); 1758Contracts.Assert(rows > 0); 1813Contracts.Assert(tmp); 1818Contracts.Assert(lookup.BlockOffset + lookup.BlockLength == _stream.Position); 1862Contracts.Assert(!_toRead.IsAddingCompleted); 1894Contracts.Assert(tmp); 1910Contracts.Assert(_remaining >= 0); 1911Contracts.Assert(_remaining == 0 || _curr != null); 1924Contracts.AssertValue(_curr); 1927Contracts.Assert(_remaining > 0); 1953Contracts.Check(_curr != null, RowCursorUtils.FetchValueStateError); 1989Contracts.Assert(ex.CancellationToken == _exMarshaller.Token); 2006Contracts.Assert(false); 2117Contracts.CheckValue(env, nameof(env)); 2147Contracts.AssertValue(ch);
DataLoadSave\Binary\BinaryLoaderSaverCatalog.cs (6)
26Contracts.CheckValue(fileSource, nameof(fileSource)); 49Contracts.CheckNonEmpty(path, nameof(path)); 52throw Contracts.ExceptParam(nameof(path), "File does not exist at path: {0}", path); 78Contracts.CheckValue(catalog, nameof(catalog)); 79Contracts.CheckValue(data, nameof(data)); 80Contracts.CheckValue(stream, nameof(stream));
DataLoadSave\Binary\BinarySaver.cs (11)
88Contracts.AssertValue(parent); 120Contracts.AssertValue(codec); 127Contracts.Assert(_writer == null); 134Contracts.Assert(_writer != null); 141Contracts.Assert(_writer != null); 192Contracts.CheckValue(env, nameof(env)); 214Contracts.AssertValue(exMarshaller); 232Contracts.Assert(tmp); 573Contracts.AssertValue(ch); 574Contracts.AssertValueOrNull(pch); 623Contracts.Assert(rows == (blockIndex + 1) * rowsPerBlock - remainingInBlock);
DataLoadSave\Binary\CodecFactory.cs (10)
37Contracts.AssertValue(env, "env"); 38Contracts.AssertValueOrNull(memPool); 88Contracts.Assert(!_loadNameToCodecCreator.ContainsKey(codec.LoadName)); 89Contracts.Assert(!_simpleCodecTypeMap.ContainsKey(codec.Type.RawType)); 96Contracts.Assert(!_loadNameToCodecCreator.ContainsKey(name)); 131Contracts.Check(mem.Length == output, "codec description length did not match stream length"); 132Contracts.Check(mem.Length <= int.MaxValue); // Is this even possible in the current implementation of MemoryStream? 156Contracts.AssertValue(definitionStream, "definitionStream"); 162Contracts.CheckDecode(!string.IsNullOrEmpty(signature), "Non-empty signature string expected"); 164Contracts.CheckDecode(ulen <= long.MaxValue, "Codec type definition read from stream too large");
DataLoadSave\Binary\Codecs.cs (80)
31Contracts.AssertValue(stream); 32Contracts.AssertValue(factory); 75Contracts.AssertValue(stream); 76Contracts.AssertValue(factory); 98Contracts.Assert(0 <= index && index <= Utils.Size(values)); 99Contracts.Assert(0 <= count && count <= Utils.Size(values) - index); 123Contracts.AssertValue(factory); 124Contracts.AssertValue(type); 125Contracts.Assert(type.RawType == typeof(T)); 250Contracts.Assert(_remaining > 0); 262Contracts.Assert(0 <= index && index <= Utils.Size(values)); 263Contracts.Assert(0 <= count && count <= Utils.Size(values) - index); 264Contracts.Assert(_remaining >= count); 327Contracts.Check(_builder != null, "writer was already committed"); 334Contracts.Check(_builder != null, "writer already committed"); 362Contracts.CheckDecode(_entries == items); 369Contracts.CheckDecode(b >= (bPrev & LengthMask) || (b & LengthMask) == (bPrev & LengthMask)); 373Contracts.CheckDecode(_text.Length == (_boundaries[_entries] & LengthMask)); 378Contracts.Check(++_index < _entries, "reader already read all values"); 383Contracts.Assert(_index < _entries); 437Contracts.Assert(0 <= _currentIndex && _currentIndex < 8); 490Contracts.Assert(0 < _remaining, "already consumed all values"); 500Contracts.Assert(0 <= _currentIndex, "have not moved in"); 501Contracts.Assert(_currentIndex < 8); 519Contracts.Assert(false, "This older form only supports reading"); 520throw Contracts.ExceptNotSupp("Writing single bit booleans no longer supported"); 543Contracts.Assert(0 < _remaining, "already consumed all values"); 553Contracts.Assert(0 <= _currentSlot, "have not moved in"); 554Contracts.Assert(_currentSlot < 16); 567throw Contracts.ExceptDecode("Invalid bit pattern in BoolCodec"); 629Contracts.Assert(_remaining > 0, "already consumed all values"); 679Contracts.Assert(_offsets != null, "writer was already committed"); 692Contracts.Assert(_offsets != null, "writer was already committed"); 693Contracts.Assert(Utils.Size(_offsets) == Utils.Size(_ticks)); 737Contracts.Assert(!_disposed); 738Contracts.Check(++_index < _entries, "reader already read all values"); 743Contracts.Assert(!_disposed); 788Contracts.AssertValue(factory); 789Contracts.AssertValue(type); 790Contracts.AssertValue(innerCodec); 791Contracts.Assert(type.RawType == typeof(VBuffer<T>)); 792Contracts.Assert(innerCodec.Type == type.ItemType); 853Contracts.Check(_valuesStream != null, "writer already committed"); 894Contracts.Assert(tmp, "TryGetBuffer failed in VBufferCodec!"); 908Contracts.Check(_valuesStream != null, "writer already committed"); 912throw Contracts.Except("Length mismatch: expected {0} slots but got {1}", _size, value.Length); 983Contracts.CheckDecode(_numVectors == items); 988Contracts.CheckDecode(codec._type.Size == _size); 990Contracts.CheckDecode(_size >= 0); 997Contracts.CheckDecode(numIndices >= 0); 1006Contracts.CheckDecode(len >= 0); 1009Contracts.CheckDecode(count == -1); 1015Contracts.CheckDecode(count < len); 1024Contracts.CheckDecode(prev < _indices[j]); 1028Contracts.CheckDecode(prev < len); 1066Contracts.Assert(_vectorIndex < _numVectors - 1, "already consumed all vectors"); 1086Contracts.Assert(_vectorIndex >= 0, "have not moved in"); 1129Contracts.CheckDecode(itemType != null); 1138Contracts.CheckDecode(d >= 0); 1188Contracts.AssertValue(factory); 1189Contracts.AssertValue(type); 1190Contracts.AssertValue(innerCodec); 1191Contracts.Assert(type.RawType == typeof(T)); 1192Contracts.Assert(innerCodec.Type.RawType == type.RawType); 1242Contracts.CheckDecode(itemType != null); 1243Contracts.CheckDecode(KeyDataViewType.IsValidDataType(itemType.RawType)); 1252Contracts.CheckDecode(min == 0); 1253Contracts.CheckDecode(0 <= count); 1254Contracts.CheckDecode((ulong)count <= itemType.GetRawKind().ToMaxInt()); 1255Contracts.CheckDecode(contiguous); 1285Contracts.AssertValue(factory); 1286Contracts.AssertValue(type); 1287Contracts.AssertValue(innerCodec); 1288Contracts.Assert(type.RawType == typeof(T)); 1289Contracts.Assert(innerCodec.Type.RawType == type.RawType); 1339Contracts.CheckDecode(itemType != null); 1340Contracts.CheckDecode(KeyDataViewType.IsValidDataType(itemType.RawType)); 1346Contracts.CheckDecode(0 < count); 1347Contracts.CheckDecode(count <= itemType.RawType.ToMaxInt()); 1360throw Contracts.ExceptParam(nameof(type), "type must be a key type");
DataLoadSave\Binary\CompressionKind.cs (2)
43throw Contracts.Except("unrecognized compression codec {0}", compression); 62throw Contracts.Except("unrecognized compression codec {0}", compression);
DataLoadSave\Binary\MemoryStreamPool.cs (4)
34Contracts.Assert(mem.Position == 0); 35Contracts.Assert(mem.Length == 0); 61Contracts.CheckParam(0 <= maxSize, nameof(maxSize), "Must be positive"); 63Contracts.Assert(0 <= index && index < _pools.Length);
DataLoadSave\CompositeDataLoader.cs (5)
37Contracts.CheckValue(loader, nameof(loader)); 38Contracts.CheckValueOrNull(transformerChain); 53Contracts.CheckValue(env, nameof(env)); 86Contracts.CheckValue(transformer, nameof(transformer)); 93Contracts.CheckValue(ctx, nameof(ctx));
DataLoadSave\CompositeLoaderEstimator.cs (3)
20Contracts.CheckValue(start, nameof(start)); 21Contracts.CheckValueOrNull(estimatorChain); 52Contracts.CheckValue(estimator, nameof(estimator));
DataLoadSave\Database\DatabaseLoader.cs (40)
46Contracts.CheckValue(env, nameof(env)); 61Contracts.AssertValue(host, "host"); 71Contracts.CheckValue(env, nameof(env)); 135throw Contracts.Except($"Cannot specify both {nameof(LoadColumnAttribute)} and {nameof(LoadColumnNameAttribute)}"); 150throw Contracts.Except($"Field {memberInfo.Name} is of unsupported type."); 156throw Contracts.Except($"Property {memberInfo.Name} is of unsupported type."); 160Contracts.Assert(false); 161throw Contracts.ExceptNotSupp("Expected a FieldInfo or a PropertyInfo"); 218Contracts.CheckValue(name, nameof(name)); 219Contracts.CheckValue(source, nameof(source)); 265Contracts.CheckParam(index >= 0, nameof(index), "Must be non-negative"); 277Contracts.CheckValue(name, nameof(name)); 290Contracts.CheckParam(min >= 0, nameof(min), "Must be non-negative"); 291Contracts.CheckParam(max >= min, nameof(max), "Must be greater than or equal to " + nameof(min)); 335Contracts.Assert(range.Max.HasValue); 368Contracts.Assert(0 <= min && min < lim); 377Contracts.Assert(name != null); 399Contracts.AssertNonEmpty(name); 400Contracts.AssertValueOrNull(segs); 401Contracts.Assert(sizeBase > 0); 404Contracts.Assert(colType.GetItemType().GetRawKind() != 0); 412Contracts.AssertNonEmpty(name); 413Contracts.AssertValue(itemType); 414Contracts.AssertValueOrNull(segs); 432Contracts.Assert(segs[a].Min <= segs[b].Min); 436Contracts.ExceptUserArg(nameof(Column.Source), "Intervals specified for column '{0}' overlap", name) : 437Contracts.ExceptDecode("Intervals specified for column '{0}' overlap", name); 449Contracts.Assert(size >= segs.Length); 474Contracts.AssertNonEmpty(cols); 544Contracts.AssertValue(ctx); 561Contracts.CheckDecode(cinfo > 0); 570Contracts.CheckDecode(Enum.IsDefined(typeof(InternalDataKind), kind)); 575Contracts.CheckDecode(KeyDataViewType.IsValidDataType(kind.ToType())); 578Contracts.CheckDecode(0 < count); 595Contracts.CheckDecode(cseg > 0); 602Contracts.CheckDecode(0 <= min && min < lim); 619Contracts.AssertValue(ctx); 642Contracts.Assert((InternalDataKind)(byte)rawKind == rawKind); 685Contracts.CheckValue(keyCount, nameof(keyCount)); 689Contracts.CheckUserArg(KeyDataViewType.IsValidDataType(rawType), nameof(DatabaseLoader.Column.Type), "Bad item type for Key");
DataLoadSave\Database\DatabaseLoaderCursor.cs (5)
98Contracts.AssertValue(parent); 99Contracts.AssertValue(source); 100Contracts.Assert(active == null || active.Length == parent._bindings.OutputSchema.Count); 772Contracts.Check(segs.Length == 1); 778Contracts.Check(seg.Lim == (seg.Min + 1));
DataLoadSave\Database\DatabaseSource.cs (4)
31Contracts.CheckValue(providerFactory, nameof(providerFactory)); 32Contracts.CheckValue(connectionString, nameof(connectionString)); 33Contracts.CheckValue(commandText, nameof(commandText)); 34Contracts.CheckUserArg(commandTimeoutInSeconds >= 0, nameof(commandTimeoutInSeconds));
DataLoadSave\DataOperationsCatalog.cs (3)
49Contracts.AssertValue(env); 525Contracts.CheckValue(env, nameof(env)); 526Contracts.CheckValueOrNull(samplingKeyColumn);
DataLoadSave\EstimatorChain.cs (11)
29Contracts.AssertValueOrNull(env); 30Contracts.AssertValueOrNull(estimators); 31Contracts.AssertValueOrNull(scopes); 32Contracts.AssertValueOrNull(needCacheAfter); 33Contracts.Assert(Utils.Size(estimators) == Utils.Size(scopes)); 34Contracts.Assert(Utils.Size(estimators) == Utils.Size(needCacheAfter)); 42Contracts.Assert((_host != null) == _needCacheAfter.Any(x => x)); 43Contracts.Assert((_estimators.Length > 0) == (LastEstimator != null)); 75Contracts.AssertValue(_host); 94Contracts.CheckValue(estimator, nameof(estimator)); 110Contracts.CheckValue(env, nameof(env));
DataLoadSave\EstimatorExtensions.cs (15)
24Contracts.CheckValue(start, nameof(start)); 25Contracts.CheckValue(estimator, nameof(estimator)); 37Contracts.CheckValue(start, nameof(start)); 38Contracts.CheckValue(estimator, nameof(estimator)); 51Contracts.CheckValue(start, nameof(start)); 52Contracts.CheckValue(estimator, nameof(estimator)); 70Contracts.CheckValue(start, nameof(start)); 80Contracts.CheckValue(loader, nameof(loader)); 81Contracts.CheckValue(transformer, nameof(transformer)); 92Contracts.CheckValue(start, nameof(start)); 93Contracts.CheckValue(transformer, nameof(transformer)); 106Contracts.AssertValue(estimator); 107Contracts.AssertValue(onFit); 148Contracts.CheckValue(estimator, nameof(estimator)); 149Contracts.CheckValue(onFit, nameof(onFit));
DataLoadSave\LegacyCompositeDataLoader.cs (19)
50Contracts.AssertNonEmpty(tag); 51Contracts.AssertValueOrNull(argsString); 52Contracts.AssertValue(transform, "transform"); 96Contracts.CheckValue(env, nameof(env)); 115Contracts.CheckValue(env, nameof(env)); 126Contracts.AssertValue(host, "host"); 179Contracts.CheckValue(env, nameof(env)); 193Contracts.AssertValue(host, "host"); 278Contracts.CheckValue(env, nameof(env)); 295Contracts.CheckValue(env, nameof(env)); 324Contracts.CheckValue(env, nameof(env)); 349Contracts.CheckValue(env, nameof(env)); 424Contracts.AssertValue(host, "host"); 452Contracts.AssertValue(host, "host"); 522Contracts.CheckValue(env, nameof(env)); 540Contracts.AssertValue(ctx); 541Contracts.AssertValue(loaderSaveAction); 542Contracts.AssertValueOrNull(transforms); 565Contracts.AssertNonEmpty(transforms[i].Tag);
DataLoadSave\MultiFileSource.cs (8)
36Contracts.CheckValueOrNull(paths); 72Contracts.CheckParam(0 <= index && index < Count, nameof(index)); 78Contracts.CheckParam(0 <= index && index < Count, nameof(index)); 87throw Contracts.ExceptIO(e, "Could not open file '{0}'. Error is: {1}", path, e.Message); 106Contracts.CheckValue(file, nameof(file)); 107Contracts.CheckParam(file.CanRead, nameof(file), "File handle must be readable"); 118Contracts.CheckParam(0 <= index && index < Count, nameof(index)); 124Contracts.CheckParam(0 <= index && index < Count, nameof(index));
DataLoadSave\Text\BlockingQueue.cs (6)
45Contracts.Assert(boundedCapacity > 0); 68Contracts.Assert(!_itemsAvailable.Completed); 96Contracts.Assert(gotItem || _itemsAvailable.Completed); 146Contracts.Assert(initialCount >= 0); 181Contracts.Assert(_count >= 0); 209Contracts.Assert(_waiters >= 0);
DataLoadSave\Text\TextLoader.cs (49)
94Contracts.CheckValue(name, nameof(name)); 95Contracts.CheckValue(source, nameof(source)); 141Contracts.AssertNonEmpty(str); 151Contracts.AssertNonEmpty(str); 192Contracts.AssertValue(sb); 277Contracts.CheckParam(index >= 0, nameof(index), "Must be non-negative"); 291Contracts.CheckParam(min >= 0, nameof(min), "Must be non-negative"); 292Contracts.CheckParam(!(max < min), nameof(max), "If specified, must be greater than or equal to " + nameof(min)); 350Contracts.AssertNonEmpty(str); 360Contracts.AssertNonEmpty(str); 406Contracts.AssertValue(sb); 584Contracts.Assert(0 <= min && min < lim && lim <= SrcLim); 595Contracts.Assert(0 <= min && min < SrcLim); 620Contracts.AssertNonEmpty(name); 621Contracts.AssertNonEmpty(segs); 622Contracts.Assert(sizeBase > 0 || isegVar >= 0); 623Contracts.Assert(isegVar >= -1); 627Contracts.Assert(Kind != 0); 636Contracts.AssertNonEmpty(name); 637Contracts.AssertValue(itemType); 638Contracts.AssertNonEmpty(segs); 649Contracts.Assert(segs[a].Min <= segs[b].Min); 653Contracts.ExceptUserArg(nameof(Column.Source), "Intervals specified for column '{0}' overlap", name) : 654Contracts.ExceptDecode("Intervals specified for column '{0}' overlap", name); 667Contracts.Assert(isegVar == -1); 673Contracts.Assert(size >= segs.Length || size >= segs.Length - 1 && isegVar >= 0); 706Contracts.AssertNonEmpty(cols); 707Contracts.AssertValueOrNull(headerFile); 708Contracts.AssertValueOrNull(dataSample); 907Contracts.AssertValue(ctx); 923Contracts.CheckDecode(cinfo > 0); 935Contracts.CheckDecode(Enum.IsDefined(typeof(InternalDataKind), kind)); 940Contracts.CheckDecode(KeyDataViewType.IsValidDataType(kind.ToType())); 947Contracts.CheckDecode(isContig); 949Contracts.CheckDecode(min == 0); 951Contracts.CheckDecode(cnt >= 0); 960Contracts.CheckDecode(0 < count); 968Contracts.CheckDecode(cseg > 0); 974Contracts.CheckDecode(0 <= min && min < lim && lim <= SrcLim); 1000Contracts.AssertValue(ctx); 1022Contracts.Assert((InternalDataKind)(byte)rawKind == rawKind); 1152Contracts.CheckValue(env, nameof(env)); 1388Contracts.CheckValue(env, nameof(env)); 1400Contracts.AssertValue(host, "host"); 1479Contracts.CheckValue(env, nameof(env)); 1613throw Contracts.Except($"Field {memberInfo.Name} is of unsupported type."); 1619throw Contracts.Except($"Property {memberInfo.Name} is of unsupported type."); 1623Contracts.Assert(false); 1624throw Contracts.ExceptNotSupp("Expected a FieldInfo or a PropertyInfo");
DataLoadSave\Text\TextLoaderCursor.cs (48)
50Contracts.AssertValue(parent); 51Contracts.Assert(active == null || active.Length == parent._bindings.OutputSchema.Count); 72Contracts.Assert(srcNeeded >= 0); 141Contracts.AssertValue(parent); 142Contracts.AssertValue(files); 143Contracts.Assert(active == null || active.Length == parent._bindings.OutputSchema.Count); 148Contracts.Assert(cthd > 0); 158Contracts.AssertValue(parent); 159Contracts.AssertValue(files); 160Contracts.Assert(active == null || active.Length == parent._bindings.OutputSchema.Count); 165Contracts.Assert(cthd > 0); 211Contracts.AssertValue(source); 212Contracts.Assert(count > 0); 213Contracts.AssertValueOrNull(lines); 223Contracts.Assert(batch.Exception == null); 242Contracts.AssertValue(files); 369Contracts.AssertValueOrNull(path); 370Contracts.AssertValueOrNull(infos); 380Contracts.AssertValue(ex); 396Contracts.Assert(line > 0); 397Contracts.AssertNonEmpty(text); 423Contracts.AssertValue(files); 424Contracts.Assert(files.Count >= 0); 425Contracts.Assert(batchSize >= 2); 426Contracts.Assert(bufSize > 0); 427Contracts.Assert(limit >= 0); 428Contracts.Assert(cref > 0); 446Contracts.Assert(n >= 0); 473Contracts.AssertValue(batch.Exception); 474throw Contracts.ExceptDecode(batch.Exception, "Stream reading encountered exception"); 489Contracts.AssertNonEmpty(separators); 687Contracts.Assert(_batchSize >= 2); 804Contracts.AssertValueOrNull(path); 805Contracts.Assert(0 <= total); 806Contracts.Assert(0 <= index && index < Utils.Size(infos)); 829Contracts.Assert(batch.Total == _total + 1, $"batch.Total:{batch.Total} while _total + 1:{_total + 1}."); 853Contracts.Assert(0 <= irowMin && irowMin < irowLim); 854Contracts.Assert(total >= 0); 894Contracts.AssertValue(curs); 895Contracts.Assert(cthd > 0); 951Contracts.Assert(0 <= tid && tid < _threads.Length); 975Contracts.Assert(iblk < _blockCount - 3); 998Contracts.Assert(lines.Exception == null); 1003Contracts.Assert(lines.Infos.Length <= BlockSize); 1009Contracts.Assert(info.Line > 0); 1010Contracts.AssertNonEmpty(info.Text); 1016Contracts.Assert(irow == batch.IrowLim); 1036Contracts.Assert(0 <= iblk && iblk < _blockCount);
DataLoadSave\Text\TextLoaderParser.cs (107)
86Contracts.Assert(type.IsStandardScalar() || type is KeyDataViewType); 87Contracts.Assert(typeof(T) == type.RawType); 99Contracts.Assert(type.IsStandardScalar() || type is KeyDataViewType); 100Contracts.Assert(typeof(T) == type.RawType); 120Contracts.Assert(0 <= index && index < _creatorsOne.Length); 127Contracts.Assert(0 <= index && index < _creatorsOne.Length); 154Contracts.CheckValue(provider, nameof(provider)); 235Contracts.AssertValue(rows); 261Contracts.AssertValue(conv); 262Contracts.Assert(typeof(TResult) == type.RawType); 271Contracts.Assert(0 <= irow && irow < _values.Length); 272Contracts.Assert(size == 0); 278Contracts.Assert(0 <= irow && irow < _values.Length); 279Contracts.Assert(index == 0); 286Contracts.Assert(-1 <= index && index < Rows.Count); 287Contracts.Check(index >= 0); 332Contracts.Assert(_size > 0); 333Contracts.Assert(-1 <= _indexPrev); 334Contracts.Assert(_indexPrev < _size); 335Contracts.Assert(0 <= _count); 336Contracts.Assert(_count <= _size); 337Contracts.Assert(_count <= _values.Length); 343Contracts.Assert(_count <= _size / 2); 344Contracts.Assert(_count <= _indices.Length); 350Contracts.Assert(size >= 0); 360Contracts.Assert(_indexPrev < index && index < _size); 393Contracts.Assert(ii <= i); 408Contracts.Assert(_count == _size); 444Contracts.AssertValue(conv); 445Contracts.Assert(typeof(TItem) == type.RawType); 456Contracts.Assert(0 <= irow && irow < _values.Length); 457Contracts.Assert(size >= 0); 463Contracts.Assert(0 <= irow && irow < _values.Length); 470Contracts.Assert(-1 <= index && index < Rows.Count); 471Contracts.Check(index >= 0); 502Contracts.AssertValue(stats); 503Contracts.Assert(count > 0); 583Contracts.AssertValueOrNull(path); 584Contracts.Assert(line >= 0); 620Contracts.AssertValue(Spans); 621Contracts.AssertValue(Indices); 622Contracts.Assert(0 <= Count && Count <= Indices.Length && Indices.Length <= Spans.Length); 628Contracts.AssertValue(Spans); 629Contracts.AssertValue(Indices); 630Contracts.Assert(Count == 0); 675Contracts.AssertValue(parent); 713Contracts.Assert(itemType is KeyDataViewType || itemType.IsStandardScalar()); 731Contracts.Assert(_inputSize >= 0); 736Contracts.AssertNonEmpty(lines); 737Contracts.Assert(parent._inputSize == 0, "Why is this being called when inputSize is known?"); 773Contracts.Assert(!textHeader.IsEmpty); 774Contracts.Assert(infos.Length == slotNames.Length); 801Contracts.Assert(!seg.IsVariable); 806Contracts.Assert(ivDst <= info.SizeBase - sizeSeg); 813Contracts.Assert(isrc < isrcLim); 817Contracts.Assert(min <= srcCur && srcCur < lim); 823Contracts.Assert(ivDst == info.SizeBase); 831Contracts.Assert(active == null || active.Length == _creator.Length); 862Contracts.AssertValue(rows); 863Contracts.Assert(irow >= 0); 864Contracts.Assert(helper is HelperImpl); 865Contracts.Assert(active == null || Utils.Size(active) == _infos.Length); 892Contracts.AssertValue(stats); 893Contracts.Assert(srcNeeded >= 0); 929Contracts.AssertValue(stats); 931Contracts.Assert(inputSize >= 0); 932Contracts.Assert(srcNeeded >= 0); 933Contracts.Assert(inputSize == 0 || srcNeeded < inputSize); 934Contracts.AssertNonEmpty(seps); 981Contracts.Assert(scan.IchMinBuf <= scan.IchMinNext && scan.IchMinNext <= scan.IchLimBuf); 988Contracts.Assert(scan.IchMinBuf <= scan.IchMinNext && scan.IchMinNext <= scan.IchLimBuf); 990Contracts.Assert(scan.IchMinBuf <= scan.IchMinNext && scan.IchMinNext <= scan.IchLimBuf); 991Contracts.Assert(scan.Index == -1); 1026Contracts.Assert(scan.IchMinBuf <= scan.IchMinNext && scan.IchMinNext <= scan.IchLimBuf); 1028Contracts.Assert(scan.IchMinBuf <= scan.IchMinNext && scan.IchMinNext <= scan.IchLimBuf); 1029Contracts.Assert(scan.Index >= -1); 1056Contracts.Assert(src - 1 <= srcNeeded); 1090Contracts.Assert(srcNeeded < inputSize); 1139Contracts.Assert(inputSize > 0); 1140Contracts.Assert(csrcSparse == inputSize - srcLimFixed); 1146Contracts.Assert(scan.IchMinBuf <= scan.IchMinNext && scan.IchMinNext <= scan.IchLimBuf); 1177Contracts.Assert(ichCol <= ichEnd); 1206Contracts.Assert(ichCur < ichLim); 1217Contracts.Assert(ichCur <= ichLim); 1245Contracts.Assert(ichCur <= ichLim); 1316Contracts.Assert(ichCur <= ichLim); 1327Contracts.Assert(ichCur <= ichLim); 1338Contracts.Assert(ichCur <= ichLim); 1359Contracts.Assert(_seps.Contains(span[ichCur])); 1367Contracts.Assert(active == null || Utils.Size(active) == _infos.Length); 1370Contracts.Assert(0 <= irow && irow < rows.Count); 1378Contracts.Assert(v != null); 1389Contracts.Assert(srcLim >= 0); 1390Contracts.Assert(info.ColType is VectorDataViewType); 1391Contracts.Assert(info.SizeBase > 0 || info.IsegVariable >= 0); 1401Contracts.Assert(sizeVar >= 0); 1409Contracts.Assert(seg.IsVariable == (i == info.IsegVariable)); 1416Contracts.Assert(lim == min + sizeVar); 1419Contracts.Assert(ivDst <= size - sizeSeg); 1426Contracts.Assert(isrc < isrcLim); 1430Contracts.Assert(min <= srcCur && srcCur < lim); 1434throw Contracts.Except($"Could not parse value {fields.Spans[isrc]} in slot {indexBase + srcCur} of column {info.Name} in line {line}"); 1454Contracts.Assert(ivDst == size); 1459Contracts.Assert(!(info.ColType is VectorDataViewType)); 1460Contracts.Assert(Utils.Size(info.Segments) == 1); 1461Contracts.Assert(info.Segments[0].Lim == info.Segments[0].Min + 1); 1470throw Contracts.Except($"Could not parse value {vs.Spans[isrc]} in line {line}, column {info.Name}");
DataLoadSave\Text\TextLoaderSaverCatalog.cs (5)
294Contracts.CheckValue(catalog, nameof(catalog)); 295Contracts.CheckValue(data, nameof(data)); 296Contracts.CheckValue(stream, nameof(stream)); 312Contracts.CheckNonEmpty(path, nameof(path)); 314throw Contracts.ExceptParam(nameof(path), "File or directory does not exist at path: {0}", path);
DataLoadSave\Text\TextSaver.cs (28)
62Contracts.AssertValue(cursor); 100Contracts.Assert(type.IsStandardScalar() || type is KeyDataViewType); 101Contracts.Assert(type.RawType == typeof(T)); 171Contracts.Check(_slotNames.Length == typeNames.Size, "Unexpected slot names length"); 265Contracts.AssertValue(args); 266Contracts.CheckValue(env, nameof(env)); 279Contracts.CheckUserArg(!string.IsNullOrEmpty(sep), nameof(Arguments.Separator), "Must specify a separator"); 299throw Contracts.ExceptUserArg(nameof(Arguments.Separator), "Invalid separator - must be: space, tab, comma, semicolon, or bar"); 554Contracts.AssertValue(parent); 555Contracts.AssertValue(parent._host); 591Contracts.Assert(len >= 0); 607Contracts.Assert(len >= 0); 629Contracts.Assert(_mpcoldst[_col] == 0); 630Contracts.Assert(_mpcolslot[_col] == 0); 647Contracts.Assert(0 <= _col && _col < _pipes.Length); 648Contracts.AssertValue(sb); 650Contracts.Check(index >= 0); 652Contracts.Check(dst > _dstPrev); 678Contracts.Assert(_col < _pipes.Length); 680Contracts.Check(_dstPrev < dst); 689Contracts.Assert(_col == _pipes.Length); 761Contracts.Assert(_col == _pipes.Length); 762Contracts.Assert(dstLim <= _dstBase); 771Contracts.Assert(slot == _slotLim || slot < _slotLim && dst <= _mpslotdst[slot]); 779Contracts.Assert(col < _pipes.Length); 820Contracts.Assert(ichCur < ichLim); 834Contracts.Assert(ichRun == ichMin); 846Contracts.Assert(ichCur == ichLim);
DataLoadSave\TransformerChain.cs (11)
86Contracts.CheckValueOrNull(transformers); 87Contracts.CheckValueOrNull(scopes); 93Contracts.Check((_transformers.Length > 0) == (LastTransformer != null)); 94Contracts.Check(_transformers.Length == _scopes.Length); 104Contracts.CheckValueOrNull(transformers); 117Contracts.Check(LastTransformer != null); 129Contracts.CheckValue(inputSchema, nameof(inputSchema)); 147Contracts.CheckValue(input, nameof(input)); 183Contracts.CheckValue(transformer, nameof(transformer)); 242Contracts.CheckValue(inputSchema, nameof(inputSchema)); 243Contracts.Check(((ITransformer)this).IsRowToRowMapper, nameof(ITransformer.GetRowToRowMapper) + " method called despite " +
DataLoadSave\TransformWrapper.cs (3)
25Contracts.CheckValue(env, nameof(env)); 26Contracts.Check(xf is IDataTransform); 70Contracts.CheckValue(host, nameof(host));
DataLoadSave\Transpose\TransposeLoader.cs (12)
152Contracts.AssertValue(parent); 168Contracts.AssertValue(parent); 183Contracts.Check(stream.Position == _offset, "Unexpected position on substream"); 202/// should be handle with <see cref="Contracts.CheckDecode(bool)"/> or by throwing 203/// <see cref="Contracts.ExceptDecode()"/>, as we consider the views not adhering to 223Contracts.Assert(view != null); 397Contracts.CheckValue(env, nameof(env)); 427Contracts.CheckValue(host, nameof(host)); 460Contracts.CheckValue(host, nameof(host)); 487Contracts.CheckValue(env, nameof(env)); 540Contracts.AssertValue(env); 711Contracts.Assert(pos <= int.MaxValue);
DataLoadSave\Transpose\TransposeSaver.cs (1)
56Contracts.CheckValue(env, nameof(env));
DataLoadSave\TrivialEstimator.cs (1)
27Contracts.AssertValue(host);
DataView\AppendRowsDataView.cs (3)
58Contracts.CheckValue(env, nameof(env)); 70Contracts.CheckValue(env, nameof(env)); 419Contracts.AssertValue(context);
DataView\ArrayDataViewBuilder.cs (7)
38Contracts.CheckValue(env, nameof(env)); 210Contracts.AssertValue(env, "env"); 383Contracts.Assert(typeof(TOut) == type.RawType); 396Contracts.AssertValue(values); 413Contracts.Assert(0 <= index && index < _values.Length); 464Contracts.AssertValue(itemType); 465Contracts.Assert(itemType.RawType == typeof(TOut));
DataView\BatchDataViewMapperBase.cs (4)
23Contracts.CheckValue(env, nameof(env)); 48Contracts.Assert(active.Length == SchemaBindings.ColumnCount); 111Contracts.CheckParam(IsColumnActive(column), nameof(column), "requested column is not active"); 116Contracts.AssertValue(_input);
DataView\CacheDataView.cs (49)
81Contracts.CheckValue(env, nameof(env)); 296Contracts.AssertValue(predicate); 508Contracts.AssertValue(toWrap); 613Contracts.Assert(rowCount.HasValue); 620Contracts.Assert(pos >= 0); 635Contracts.AssertValue(waiter); 659Contracts.AssertValue(parent); 660Contracts.AssertValue(pred); 670Contracts.Assert(pred(c)); 671Contracts.AssertValue(_parent._caches[c]); 679Contracts.AssertValue(_parent._cacheDefaultWaiter); 708Contracts.AssertValue(waiter); 768Contracts.Assert(_curr >= 0); 777Contracts.Check(_curr >= 0, "Cannot call ID getter in current state"); 785Contracts.Assert(_curr >= -1); // Should not be called when _curr = -2. 803Contracts.AssertValue(index); 825Contracts.AssertValue(perm); 833Contracts.Assert(0 <= _curr && _curr < _perm.Length); 842Contracts.Check(_curr >= 0, "Cannot call ID getter in current state"); 849Contracts.Assert(_curr >= -1); // Should not be called when _curr = -2. 852Contracts.Assert(_perm[_curr] >= 0); 856Contracts.Assert(result); 874Contracts.AssertValue(index); 959Contracts.AssertValue(scheduler); 969Contracts.Assert(_curr >= 0); 978Contracts.Check(_curr >= 0, "Cannot call ID getter in current state"); 985Contracts.Assert(_curr >= -1); 990Contracts.Assert(_reserved); 1004Contracts.Assert(_waiter.Wait(_curr)); 1012Contracts.Assert((_curr & _batchMask) < _batchMask); 1031Contracts.AssertValue(index); 1064Contracts.AssertValue(scheduler); 1065Contracts.AssertValue(perm); 1075Contracts.Assert(0 <= _curr && _curr < _perm.Length); 1084Contracts.Check(_curr >= 0, "Cannot call ID getter in current state"); 1091Contracts.Assert(_curr >= -1); // Should not be called when _curr = -2. 1109Contracts.Assert(0 <= _curr && _curr <= _currMax); 1111Contracts.Assert(result); 1126Contracts.AssertValue(index); 1157Contracts.AssertValue(parent); 1265Contracts.AssertValue(ctx); 1281Contracts.AssertValue(parent); 1440Contracts.Assert(0 <= _rowCount && _rowCount < int.MaxValue); 1441Contracts.AssertValue(Waiter); 1442Contracts.AssertValue(_getter); 1450Contracts.Assert(0 <= idx && idx < _rowCount); 1468Contracts.AssertValue(input); 1469Contracts.Assert(0 <= srcCol && srcCol < input.Schema.Count); 1470Contracts.Assert(input.Schema[srcCol].Type.RawType == typeof(T));
DataView\CompositeRowToRowMapper.cs (8)
34Contracts.CheckValue(inputSchema, nameof(inputSchema)); 35Contracts.CheckValueOrNull(mappers); 54Contracts.CheckValue(input, nameof(input)); 55Contracts.CheckValue(activeColumns, nameof(activeColumns)); 56Contracts.CheckParam(input.Schema == InputSchema, nameof(input), "Schema did not match original schema"); 69throw Contracts.ExceptParam(nameof(input), $"Mapper required column '{input.Schema[c].Name}' active but it was not."); 96Contracts.AssertValue(row); 97Contracts.AssertValue(pred);
DataView\DataViewConstructionUtils.cs (31)
29Contracts.AssertValue(env); 42Contracts.AssertValue(env); 55Contracts.AssertValue(env); 64Contracts.AssertValue(env); 97Contracts.AssertValue(env); 112Contracts.AssertValue(env); 217Contracts.AssertValue(env); 434Contracts.AssertValue(getter); 464Contracts.AssertValue(env); 546Contracts.AssertValue(env); 694Contracts.CheckValue(data, nameof(data)); 774Contracts.Assert(_current != null, "The current object must be set prior to cursoring"); 808Contracts.AssertValue(schemaDefn); 844Contracts.AssertValueOrNull(annotationType); 845Contracts.AssertNonEmpty(kind); 878Contracts.Assert(value != null); 896throw Contracts.Except("Value inputted is supposed to be {0}, but type of Annotationinfo is {1}", 903throw Contracts.Except( 917Contracts.Assert(AnnotationType is VectorDataViewType); 918Contracts.Check(typeof(TDst).IsGenericType && typeof(TDst).GetGenericTypeDefinition() == typeof(VBuffer<>)); 925Contracts.Check(dstItemType == typeof(ReadOnlyMemory<char>)); 932Contracts.Check(itemType == dstItemType); 941Contracts.Assert(typeT.IsGenericType); 942Contracts.Check(typeof(TDst).IsGenericType); 943Contracts.Assert(typeT.GetGenericTypeDefinition() == typeof(VBuffer<>)); 944Contracts.Check(typeof(TDst).GetGenericTypeDefinition() == typeof(VBuffer<>)); 947Contracts.Assert(itemType == annotationVectorType.ItemType.RawType); 948Contracts.Check(itemType == dstItemType); 957Contracts.Assert(AnnotationType is TextDataViewType); 962Contracts.Assert(AnnotationType.RawType == typeT); 965throw Contracts.ExceptNotImpl("Type '{0}' is not yet supported.", typeT.FullName);
DataView\DataViewExtensions.cs (3)
23Contracts.AssertValue(columnsNeeded, $"The {nameof(columnsNeeded)} cannot be null. Pass an empty array, to indicate that no columns is needed."); 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}" +
DataView\EmptyDataView.cs (1)
25Contracts.CheckValue(env, nameof(env));
DataView\InternalSchemaDefinition.cs (30)
56Contracts.AssertNonEmpty(columnName); 57Contracts.AssertValue(columnType); 58Contracts.AssertValueOrNull(generator); 62Contracts.AssertValue(memberInfo); 68Contracts.AssertValue(returnParameterInfo); 95Contracts.AssertNonEmpty(ColumnName); 96Contracts.AssertValue(ColumnType); 97Contracts.AssertValueOrNull(Generator); 100Contracts.Assert(IsComputed == (Generator != null)); 103Contracts.Assert((Generator == null) != (MemberInfo == null)); 108Contracts.AssertValue(ReturnParameterInfo); 113Contracts.Assert(parameterTypes.Length == 3); 114Contracts.Assert(parameterTypes[2].IsByRef); 115Contracts.Assert(parameterTypes[1] == typeof(long)); 116Contracts.Assert(!(parameterTypes[0].GetTypeInfo().IsPrimitive || parameterTypes[0] == typeof(string))); 119Contracts.Assert(Generator.GetMethodInfo().ReturnType == typeof(void)); 123Contracts.Assert(isVector == ColumnType is VectorDataViewType); 124Contracts.Assert(itemType == ColumnType.GetItemType().RawType); 130Contracts.AssertValue(columns); 146Contracts.AssertValue(memberInfo); 158Contracts.Assert(false); 159throw Contracts.ExceptNotSupp("Expected a FieldInfo or a PropertyInfo"); 201throw Contracts.ExceptParam(nameof(rawType), "Could not determine an IDataView type and registered custom types for member {0}", name); 213Contracts.AssertValue(userType); 214Contracts.AssertValueOrNull(userSchemaDefinition); 225throw Contracts.ExceptParam(nameof(userSchemaDefinition), "Null field name detected in schema definition"); 239throw Contracts.ExceptParam(nameof(userSchemaDefinition), "No field or property with name '{0}' found in type '{1}'", 255throw Contracts.ExceptParam(nameof(userSchemaDefinition), "No return parameter found in computed column."); 278throw Contracts.ExceptParam(nameof(userSchemaDefinition), "Column '{0}' is supposed to be {1}, but type of associated field '{2}' is {3}", 284throw Contracts.ExceptParam(nameof(userSchemaDefinition), "Column '{0}' is supposed to have item type {1}, but associated field has type {2}",
DataView\LambdaColumnMapper.cs (1)
24Contracts.CheckValue(env, nameof(env));
DataView\LambdaFilter.cs (1)
23Contracts.CheckValue(env, nameof(env));
DataView\RowToRowMapperTransform.cs (15)
98Contracts.CheckValue(mapper, nameof(mapper)); 99Contracts.CheckValueOrNull(mapperFactory); 106Contracts.CheckValue(inputSchema, nameof(inputSchema)); 107Contracts.CheckValue(mapper, nameof(mapper)); 123Contracts.CheckValue(env, nameof(env)); 151Contracts.Assert(active.Length == n); 154Contracts.Assert(activeInput.Length == _bindings.InputSchema.Count); 170Contracts.AssertValue(active); 171Contracts.Assert(active.Length == _bindings.Schema.Count); 176Contracts.Assert(0 <= col && col < _bindings.AddedColumnIndices.Count); 271Contracts.CheckValue(env, nameof(env)); 273Contracts.CheckValue(newSource, nameof(newSource)); 337Contracts.Assert(originFn != null); 340throw Contracts.Except($"Invalid TValue in GetGetter: '{typeof(TValue)}', " + 407throw Contracts.Except($"Invalid TValue in GetGetter: '{typeof(TValue)}', " +
DataView\SimpleRow.cs (8)
40Contracts.CheckValue(schema, nameof(schema)); 41Contracts.CheckValue(input, nameof(input)); 42Contracts.Check(Utils.Size(getters) == schema.Count); 43Contracts.CheckValueOrNull(disposer); 57Contracts.CheckParam(column.Index < _getters.Length, nameof(column), "Invalid col value in GetGetter"); 58Contracts.Check(IsColumnActive(column)); 61throw Contracts.Except("Unexpected TValue in GetGetter"); 69Contracts.Check(column.Index < _getters.Length);
DataView\Transposer.cs (44)
57Contracts.CheckValue(env, nameof(env)); 77Contracts.CheckValue(env, nameof(env)); 87Contracts.AssertValue(host); 205Contracts.AssertValue(host, "host"); 221Contracts.AssertValue(host); 741Contracts.AssertValue(host, "host"); 913Contracts.AssertValue(view); 914Contracts.Assert(0 <= col && col < view.Schema.Count); 926Contracts.Assert(type is PrimitiveDataViewType || vectorSize > 0); 953Contracts.Assert(Utils.IsIncreasing(1, ends, vectorSize + 1)); 984Contracts.AssertValue(parent); 985Contracts.AssertValue(input); 986Contracts.Assert(input.IsColumnActive(input.Schema[parent.SrcCol])); 1011Contracts.Assert(_view.Schema[col].Type.RawType == typeof(T)); 1024Contracts.AssertValue(row); 1025Contracts.Assert(row.Schema == _view.Schema); 1026Contracts.AssertValue(pred); 1027Contracts.Assert(row.IsColumnActive(row.Schema[SrcCol])); 1038Contracts.Assert(Parent.ColumnCount == 1); 1047Contracts.CheckParam(column.Index < Parent.ColumnCount, nameof(column)); 1060Contracts.Check(IsColumnActive(column)); 1096Contracts.Assert(Utils.Size(lims) >= 2); 1097Contracts.AssertValue(type); 1098Contracts.Assert(type.Size > 0); 1099Contracts.Assert(type.ItemType.RawType == typeof(T)); 1100Contracts.Assert(Utils.IsIncreasing(0, lims, type.Size + 1)); 1101Contracts.Assert(lims[lims.Length - 1] == type.Size); 1118Contracts.AssertValue(row); 1119Contracts.Assert(row.Schema == _view.Schema); 1120Contracts.AssertValue(pred); 1121Contracts.Assert(row.IsColumnActive(row.Schema[SrcCol])); 1156Contracts.CheckParam(column.Index < Parent.ColumnCount, nameof(column)); 1169Contracts.Check(IsColumnActive(column) && column.Index < _getters.Length); 1170Contracts.AssertValue(_getters[column.Index]); 1174throw Contracts.Except($"Invalid TValue in GetGetter: '{typeof(TValue)}', " + 1227Contracts.Assert(_inputValue.Length == Parent._lims[Parent._lims.Length - 1]); 1342Contracts.CheckValue(view, nameof(view)); 1343Contracts.CheckParam(0 <= col && col < view.Schema.Count, nameof(col)); 1348throw Contracts.Except("Could not get single value on column '{0}' because there are no slots", view.Schema[col].Name); 1351throw Contracts.Except("Could not get single value on column '{0}' because there is more than one slot", view.Schema[col].Name); 1369Contracts.CheckValueOrNull(ctx); 1396Contracts.CheckValue(provider, nameof(provider)); 1426Contracts.CheckValue(env, nameof(env)); 1537Contracts.AssertValue(cursor);
DataView\TypedCursor.cs (17)
92Contracts.AssertValue(env, "env"); 244Contracts.Assert(false); 245throw Contracts.ExceptNotSupp("Expected a FieldInfo or a PropertyInfo"); 254throw Contracts.ExceptParam(nameof(actualType), $"The expected type '{expectedType.RawType}' does not match the type of the '{singleName}' member: '{actualType}'. Please change the {singleName} member to '{expectedType.RawType}'"); 278throw Contracts.ExceptParam(nameof(schemaDefinition), "Null field name detected in schema definition"); 314Contracts.AssertValue(env); 337Contracts.AssertValue(parent); 338Contracts.AssertValue(parent._host); 429Contracts.AssertValue(typedPoke); 430Contracts.AssertValue(typedPeek); 451Contracts.AssertValue(typedPoke); 452Contracts.AssertValue(typedPeek); 488Contracts.AssertValue(typedPoke); 501Contracts.Assert(peek == null); 504Contracts.AssertValue(typedPoke); 518Contracts.AssertValue(typedPoke); 519Contracts.AssertValue(typedPeek);
DataView\ZipBinding.cs (5)
27Contracts.AssertNonEmpty(sources); 53Contracts.AssertValue(predicate); 69Contracts.CheckParam(0 <= col && col < _cumulativeColCounts[_cumulativeColCounts.Length - 1], nameof(col), "Column index out of range"); 77Contracts.Assert(0 <= srcIndex && srcIndex < _cumulativeColCounts.Length); 79Contracts.Assert(0 <= srcCol && srcCol < _sources[srcIndex].Count);
DataView\ZipDataView.cs (2)
34Contracts.CheckValue(env, nameof(env)); 47Contracts.AssertValue(host);
DebuggerExtensions.cs (4)
44Contracts.CheckValue(estimator, nameof(estimator)); 45Contracts.CheckValue(data, nameof(data)); 46Contracts.CheckParam(maxRows >= 0, nameof(maxRows)); 47Contracts.CheckParam(maxTrainingRows >= 0, nameof(maxTrainingRows));
Deprecated\Instances\HeaderSchema.cs (33)
30Contracts.CheckValue(collection, nameof(collection)); 46Contracts.Assert(col == 0); 56Contracts.Assert(nameList.Count == indexList.Count); 87Contracts.CheckParam(count >= 0, nameof(count)); 88Contracts.CheckValueOrNull(names); 104Contracts.CheckParam(count >= 0, nameof(count)); 105Contracts.CheckValue(map, nameof(map)); 130Contracts.Assert(iv == cnn); 155Contracts.AssertValue(ctx); 186Contracts.AssertValue(ctx); 196Contracts.CheckDecode(size >= 0); 199Contracts.CheckDecode(isize >= -1); 218Contracts.CheckDecode(prev < indices[ii]); 221Contracts.CheckDecode(prev < size); 248Contracts.Assert(0 <= index && index < Count); 298Contracts.Assert(count >= 0); 299Contracts.AssertValueOrNull(names); 318Contracts.CheckParam(0 <= index && index < _count, nameof(index)); 332Contracts.AssertValue(lookup); 376Contracts.Assert(count >= 0); 377Contracts.AssertValue(names); 381Contracts.Assert(size > 2 * cnn); 391Contracts.Assert(cv < cnn); 397Contracts.Assert(cv == cnn); 409Contracts.Assert(count >= 0); 410Contracts.AssertValue(indices); 411Contracts.AssertValue(names); 412Contracts.Assert(indices.Length == names.Length); 413Contracts.Assert(indices.Length <= count); 427Contracts.CheckParam(0 <= index && index < _length, nameof(index)); 441Contracts.Assert(iv == _indices.FindIndexSorted(index)); 464Contracts.AssertValue(lookup); 471Contracts.AssertValue(name);
Deprecated\Vector\GenericSpanSortHelper.cs (19)
50Contracts.Assert(index >= 0 && length >= 0 && (keys.Length - index >= length), "Check the arguments in the caller!"); 91Contracts.Assert(left >= 0); 92Contracts.Assert(length >= 0); 93Contracts.Assert(length <= keys.Length); 94Contracts.Assert(length + left <= keys.Length); 95Contracts.Assert(length + left <= values.Length); 105Contracts.Assert(lo >= 0); 106Contracts.Assert(hi < keys.Length); 150Contracts.Assert(lo >= 0); 151Contracts.Assert(hi > lo); 152Contracts.Assert(hi < keys.Length); 193Contracts.Assert(lo >= 0); 194Contracts.Assert(hi > lo); 195Contracts.Assert(hi < keys.Length); 211Contracts.Assert(lo >= 0); 212Contracts.Assert(lo < keys.Length); 236Contracts.Assert(lo >= 0); 237Contracts.Assert(hi >= lo); 238Contracts.Assert(hi <= keys.Length);
Deprecated\Vector\VBufferMathUtils.cs (21)
117Contracts.Assert(length == count); 141Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality."); 169Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality."); 194Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality."); 205Contracts.Assert(length > 0); 224Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality."); 242Contracts.CheckParam(0 <= offset && offset <= dst.Length, nameof(offset)); 243Contracts.CheckParam(src.Length <= dst.Length - offset, nameof(offset)); 270Contracts.Assert(dMin - dLim <= src.Length); 308Contracts.Assert(dLim < dstValues.Length); 325Contracts.Assert(iDD == iS + dMin); 327Contracts.Assert(iDD >= iD); 346Contracts.Assert(iDD >= iD); 418Contracts.Assert(-1 <= ind && ind < srcValues.Length); 426Contracts.Assert(srcIndices[ind] >= ind); 439Contracts.Assert(ind <= srcIndices.Length); 440Contracts.Assert(ind == srcIndices.Length || ind < srcIndices[ind]); 454Contracts.Assert(-1 <= ind && ind < srcValues.Length); 462Contracts.Assert(srcIndices[ind] >= ind); 475Contracts.Assert(ind <= srcIndices.Length); 476Contracts.Assert(ind == srcIndices.Length || ind < srcIndices[ind]);
Deprecated\Vector\VectorUtils.cs (36)
25Contracts.Check(Utils.Size(a) == Utils.Size(b), "Arrays must have the same length"); 26Contracts.Check(Utils.Size(a) > 0); 32Contracts.Check(Utils.Size(a) == b.Length, "Vectors must have the same dimensionality."); 43Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality."); 72Contracts.CheckParam(top >= 0, nameof(top), "Top count needs to be non-negative"); 73Contracts.CheckParam(bottom >= 0, nameof(bottom), "Bottom count needs to be non-negative"); 97Contracts.Assert(bottomHeap.Count == bottom); 110Contracts.Assert(topHeap.Count == top); 132Contracts.Assert(count == newCount); 162Contracts.Check(a.Length == dst.Length, "Vectors must have the same dimensionality."); 175Contracts.Assert(valuesA.Length == indicesA.Length); 176Contracts.Assert(valuesB.Length == indicesB.Length); 235Contracts.Assert(0 <= length && length <= valuesA.Length); 236Contracts.Assert(0 <= length && length <= valuesB.Length); 253Contracts.Check(0 <= offset && offset <= a.Length); 254Contracts.Check(b.Length <= a.Length - offset, "VBuffer b must be no longer than a.Length - offset."); 305Contracts.Check(0 <= offset && offset <= a.Length); 306Contracts.Check(b.Length <= a.Length - offset, "VBuffer b must be no longer than a.Length - offset."); 319Contracts.AssertNonEmpty(aValues); 320Contracts.AssertNonEmpty(aIndices); 321Contracts.AssertNonEmpty(bValues); 322Contracts.AssertNonEmpty(bIndices); 323Contracts.Assert(0 <= ia && ia < iaLim && iaLim <= aIndices.Length); 324Contracts.Assert(0 <= ib && ib < ibLim && ibLim <= bIndices.Length); 396Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality."); 416Contracts.CheckValue(a, nameof(a)); 417Contracts.Check(Utils.Size(a) == b.Length, "Vectors must have the same dimensionality."); 428Contracts.CheckValue(src, nameof(src)); 429Contracts.CheckValue(dst, nameof(dst)); 430Contracts.CheckParam(src.Length == dst.Length, nameof(dst), "Arrays must have the same dimensionality."); 444Contracts.CheckParam(src.Length == dst.Length, nameof(dst), "Arrays must have the same dimensionality."); 470Contracts.CheckValue(dst, nameof(dst)); 471Contracts.Check(0 <= offset && offset <= dst.Length); 472Contracts.Check(src.Length <= dst.Length - offset, "Vector src must be no longer than dst.Length - offset."); 499Contracts.Check(src.Length == dst.Length, "Arrays must have the same dimensionality."); 543Contracts.Check(a.Length == b.Length, "Arrays must have the same dimensionality.");
Dirty\ChooseColumnsByIndexTransform.cs (9)
64Contracts.AssertValue(options); 65Contracts.AssertValue(sourceSchema); 95Contracts.Check(sources.Length > 0, "Choose columns by index has no output column."); 113Contracts.Check(selectedIndex < _sourceSchema.Count, fmt); 124Contracts.AssertValue(ctx); 125Contracts.AssertValue(sourceSchema); 144Contracts.AssertValue(ctx); 160Contracts.AssertValue(predicate); 217Contracts.CheckValue(env, nameof(env));
Dirty\IniFileUtils.cs (2)
25throw Contracts.ExceptNotImpl("Need to make the replacing of Evaluators= more robust"); 42Contracts.Check(match.Success, "Unable to retrieve number of evaluators from ini");
Dirty\ModelParametersBase.cs (4)
26Contracts.CheckValue(env, nameof(env)); 34Contracts.CheckValue(env, nameof(env)); 61Contracts.AssertValue(ctx); 80Contracts.CheckValue(provider, nameof(provider));
Dirty\PredictionUtils.cs (2)
43Contracts.Assert(false); 48throw Contracts.Except(errorMsg);
Dirty\PredictorUtils.cs (5)
20Contracts.CheckValue(ch, nameof(ch)); 40Contracts.CheckValue(ch, nameof(ch)); 72Contracts.CheckValue(ch, nameof(ch)); 87Contracts.CheckValue(ch, nameof(ch)); 119Contracts.CheckValue(ch, nameof(ch));
EntryPoints\EntryPointNode.cs (29)
23Contracts.AssertValue(variable); 32throw Contracts.ExceptNotImpl(); 64Contracts.Assert(CheckType(typeof(T))); 104Contracts.Assert(Var<T>.CheckType(typeof(T))); 110Contracts.Assert(Var<T>.CheckType(typeof(T))); 139Contracts.Assert(Var<T>.CheckType(typeof(T))); 181Contracts.CheckValue(variableType, nameof(variableType)); 197Contracts.Assert(false, "Unexpected type for array variable"); 205Contracts.Assert(variableType.IsGenericType && variableType.GetGenericTypeDefinition() == typeof(Dictionary<,>) 218Contracts.AssertValueOrNull(ectx); 271Contracts.AssertValueOrNull(ectx); 472Contracts.AssertValue(env); 524Contracts.AssertValue(ch); 565Contracts.CheckValue(env, nameof(env)); 884Contracts.AssertValue(env); 991Contracts.CheckValue(env, nameof(env)); 1054Contracts.AssertNonWhiteSpace(varName); 1071Contracts.AssertValue(ectx); 1106Contracts.AssertValue(ectx); 1114Contracts.CheckNonWhiteSpace(newName, nameof(newName)); 1133Contracts.AssertValue(variable); 1151Contracts.AssertNonWhiteSpace(key); 1157Contracts.AssertValue(variable); 1159throw Contracts.ExceptNotImpl("Diction-based value retrieval is not supported."); 1177Contracts.Assert(index >= 0); 1183Contracts.AssertValue(variable, nameof(variable)); 1207Contracts.AssertNonWhiteSpace(name); 1244Contracts.AssertNonWhiteSpace(key); 1272Contracts.Check(index >= 0);
EntryPoints\InputBase.cs (1)
43Contracts.CheckValueOrNull(ectx);
EntryPoints\InputBuilder.cs (26)
32Contracts.AssertValue(input); 33Contracts.AssertValueOrNull(range); 57Contracts.CheckValue(ectx, nameof(ectx)); 77Contracts.CheckValueOrNull(rangeAttr); 168throw Contracts.Except($"Unknown input name {name}"); 219Contracts.CheckValue(instance, nameof(instance)); 220Contracts.Check(instance.GetType() == _type); 234Contracts.Assert(bindings.Count > 0); 239Contracts.Assert(bindings.Count == 1); 241Contracts.Assert(success); 242Contracts.AssertValue(varBinding); 252Contracts.Assert(parameterBinding is ArrayIndexParameterBinding); 254Contracts.Assert(success); 255Contracts.AssertValue(varBinding); 264Contracts.Assert(paramBinding is DictionaryKeyParameterBinding); 265throw Contracts.ExceptNotImpl("Dictionary of variables not yet implemented."); 348Contracts.Assert(success); 360Contracts.Assert(success); 393Contracts.Assert(type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Optional<>)); 402Contracts.AssertValue(ectx); 534Contracts.AssertValue(ectx); 546Contracts.AssertValue(ectx); 579Contracts.AssertValue(ectx); 590Contracts.AssertValue(ectx); 616Contracts.AssertValue(ectx); 666Contracts.CheckValue(ectx, nameof(ectx));
EntryPoints\PredictorModelImpl.cs (11)
32Contracts.CheckValue(env, nameof(env)); 44Contracts.CheckValue(env, nameof(env)); 62Contracts.AssertValue(transformModel); 63Contracts.AssertValue(predictor); 64Contracts.AssertValue(roleMappings); 72Contracts.CheckValue(env, nameof(env)); 92Contracts.CheckValue(env, nameof(env)); 95Contracts.AssertValue(newTransformModel); 101Contracts.CheckValue(env, nameof(env)); 111Contracts.CheckValue(env, nameof(env)); 140Contracts.CheckValue(env, nameof(env));
EntryPoints\SchemaManipulation.cs (3)
20Contracts.CheckValue(env, nameof(env)); 32Contracts.CheckValue(env, nameof(env)); 44Contracts.CheckValue(env, nameof(env));
EntryPoints\SelectRows.cs (4)
21Contracts.CheckValue(env, nameof(env)); 34Contracts.CheckValue(env, nameof(env)); 46Contracts.CheckValue(env, nameof(env)); 58Contracts.CheckValue(env, nameof(env));
EntryPoints\SummarizePredictor.cs (1)
34Contracts.CheckValue(env, nameof(env));
EntryPoints\TransformModelImpl.cs (8)
62Contracts.CheckValue(env, nameof(env)); 73Contracts.AssertValue(env); 86Contracts.CheckValue(env, nameof(env)); 110Contracts.CheckValue(env, nameof(env)); 138Contracts.CheckValue(env, nameof(env)); 148Contracts.CheckValue(env, nameof(env)); 171Contracts.CheckValue(env, nameof(env)); 205Contracts.CheckValue(ectx, nameof(ectx));
Evaluators\AnomalyDetectionEvaluator.cs (5)
244Contracts.Assert(!Single.IsNaN(label)); 282Contracts.Assert(truePositives <= NumAnomalies); 570Contracts.Assert(!IsActive()); 724Contracts.Assert(hasStrat == hasStratVals); 816Contracts.CheckValue(env, nameof(env));
Evaluators\AucAggregator.cs (14)
47Contracts.Assert(reservoirSize >= -1); 91Contracts.Assert(_negReservoir != null); 99Contracts.AssertValue(_posExamples); 100Contracts.AssertValue(_negExamples); 114Contracts.Check(PosSample != null && NegSample != null, "Must call Finish() before computing AUC"); 115Contracts.CheckParam(PosSample.Any(), nameof(PosSample), "AUC is not defined when there is no positive class in the data"); 116Contracts.CheckParam(NegSample.Any(), nameof(NegSample), "AUC is not defined when there is no negative class in the data"); 132Contracts.AssertValue(PosSample); 133Contracts.AssertValue(NegSample); 211Contracts.AssertValue(examples); 233Contracts.AssertValue(PosSample); 234Contracts.AssertValue(NegSample); 346Contracts.AssertValue(examples); 376Contracts.Assert(reservoirSize > 0);
Evaluators\BinaryClassifierEvaluator.cs (8)
193Contracts.CheckValue(schema, nameof(schema)); 194Contracts.CheckParam(schema.Label != null, nameof(schema), "Could not find the label column"); 702Contracts.Assert(!IsActive()); 1108Contracts.CheckValue(env, nameof(env)); 1117Contracts.CheckValue(ctx, nameof(ctx)); 1129Contracts.Assert(FloatUtils.IsFinite(_threshold)); 1131Contracts.Assert(!string.IsNullOrEmpty(_probCol) || _useRaw); 1505Contracts.CheckValue(env, nameof(env));
Evaluators\ClusteringEvaluator.cs (5)
329Contracts.Assert(features.HasValue); 339Contracts.Assert(Utils.Size(scores) == _numClusters); 340Contracts.Assert(Utils.Size(indices) == _numClusters); 623Contracts.CheckValue(env, nameof(env)); 860Contracts.CheckValue(env, nameof(env));
Evaluators\EvaluatorBase.cs (13)
27Contracts.CheckValue(env, nameof(env)); 250Contracts.AssertValue(env); 350Contracts.AssertValue(schema); 351Contracts.AssertNonWhiteSpace(stratCol); 352Contracts.AssertValue(createAgg); 367Contracts.AssertNonWhiteSpace(stratCol); 368Contracts.AssertValue(createAgg); 372throw Contracts.ExceptUserArg(nameof(MamlEvaluatorBase.ArgumentsBase.StratColumns), 409Contracts.Assert(stratType.RawType == typeof(TStrat)); 417Contracts.Assert(col.HasValue); 419Contracts.AssertValue(_stratGetter); 481Contracts.AssertValue(env); 482Contracts.AssertNonEmpty(scoreCol);
Evaluators\EvaluatorUtils.cs (46)
61Contracts.CheckValueOrNull(env); 70Contracts.Assert(map.ContainsKey(kind)); 111Contracts.CheckValueOrNull(ectx); 166Contracts.CheckValueOrNull(ectx); 217Contracts.CheckValueOrNull(ectx); 236Contracts.CheckValueOrNull(str); 237Contracts.CheckValueOrNull(def); 256Contracts.CheckValue(metricsView, nameof(metricsView)); 271throw Contracts.Except("If data contains a '{0}' column, it must also contain a '{1}' column", 331Contracts.Check(!foundRow, "Multiple metric rows found in metrics data view."); 378Contracts.Check(typeSrc.RawType == typeof(TSrc)); 392Contracts.CheckValue(env, nameof(env)); 412Contracts.Check(typeSrc.RawType == typeof(TSrc)); 433Contracts.CheckValue(env, nameof(env)); 461Contracts.CheckNonEmpty(views, nameof(views)); 462Contracts.CheckValue(itemType, nameof(itemType)); 463Contracts.CheckParam(typeof(T) == itemType.RawType, nameof(itemType), "Generic type does not match the item type"); 512Contracts.Assert(src.Length == Utils.Size(map)); 536Contracts.Assert(src.Length == Utils.Size(map)); 556Contracts.AssertValue(indices); 557Contracts.AssertValue(reconciledKeyNames); 566throw Contracts.Except($"Schema number {i} does not contain column '{columnName}'"); 573throw Contracts.Except($"Column '{columnName}' in schema number {i} does not have the correct type"); 576throw Contracts.Except($"Column '{columnName}' in schema number {i} does not have the correct type of key values"); 579throw Contracts.Except($"Column '{columnName}' must be a U4 key type, but is '{typeItemType}'"); 604Contracts.CheckNonEmpty(views, nameof(views)); 605Contracts.CheckNonEmpty(columnName, nameof(columnName)); 645Contracts.CheckNonEmpty(views, nameof(views)); 646Contracts.CheckNonEmpty(columnName, nameof(columnName)); 674Contracts.CheckNonEmpty(views, nameof(views)); 675Contracts.CheckNonEmpty(columnName, nameof(columnName)); 754Contracts.CheckValue(env, nameof(env)); 789Contracts.CheckValue(env, nameof(env)); 808Contracts.AssertValue(env); 1151throw Contracts.Except("Multiple weighted rows found in metrics data view."); 1161throw Contracts.Except("Multiple unweighted rows found in metrics data view."); 1199Contracts.AssertValue(vBufferGetters[i]); 1211Contracts.Assert(iMetric == metricNames.Count); 1217Contracts.AssertValue(env); 1248Contracts.Assert(dst.IsDense); 1325Contracts.AssertValue(dvBldr); 1479Contracts.Check(type != null && type.IsKnownSize && type.ItemType == NumberDataViewType.Double); 1504throw Contracts.Except("Expected {0} values in 'Count' column, but got {1}.", numClasses, count.Length); 1551Contracts.Assert(sumSqMetrics != null || numFolds == 1); 1611Contracts.Assert(rowDigitLen >= 1); 1614Contracts.Assert((rowDigitLen == 0) == !useNumbersInHeader);
Evaluators\MamlEvaluator.cs (1)
98Contracts.CheckValue(env, nameof(env));
Evaluators\Metrics\ConfusionMatrix.cs (1)
68Contracts.AssertValue(host);
Evaluators\MulticlassClassificationEvaluator.cs (2)
670Contracts.CheckValue(env, nameof(env)); 1093Contracts.CheckValue(env, nameof(env));
Evaluators\MultiOutputRegressionEvaluator.cs (14)
240Contracts.AssertValue(lossFunction); 241Contracts.Assert(size > 0); 250Contracts.Assert(length == _l1Loss.Length); 251Contracts.Assert(score.Length >= length); 252Contracts.Assert(label.Length >= length); 304Contracts.Assert(PassNum < 1); 305Contracts.Assert(schema.Label.HasValue); 311Contracts.AssertValue(_labelGetter); 312Contracts.AssertValue(_scoreGetter); 321Contracts.Check(_label.Length == _size); 323Contracts.Check(_score.Length == _size); 421Contracts.CheckValue(env, nameof(env)); 430Contracts.CheckValue(ctx, nameof(ctx)); 776Contracts.CheckValue(env, nameof(env));
Evaluators\QuantileRegressionEvaluator.cs (8)
125Contracts.Assert(size > 0); 140Contracts.Check(score.Length == TotalL1Loss.Length, "Vectors must have the same dimensionality."); 172Contracts.Check(loss.Length == TotalL1Loss.Length, "Vectors must have the same dimensionality."); 193Contracts.Assert(SumWeights > 0); 194Contracts.Assert(src.IsDense); 319Contracts.CheckValue(env, nameof(env)); 328Contracts.CheckValue(ctx, nameof(ctx)); 561Contracts.CheckValue(env, nameof(env));
Evaluators\RankingEvaluator.cs (17)
356Contracts.Assert(truncationLevel > 0); 357Contracts.AssertValue(labelGains); 454Contracts.Assert(PassNum < 1); 455Contracts.Assert(schema.Label.HasValue); 456Contracts.Assert(schema.Group.HasValue); 509Contracts.Check(weight == _currentQueryWeight, "Weights within query differ"); 602Contracts.CheckValue(env, nameof(env)); 649Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 655Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 663Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 671Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 682Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 839Contracts.Assert(0 < truncationLevel); 999Contracts.Assert(Utils.Size(groupMaxDcgCur) == truncationLevel); 1061Contracts.Assert(0 <= i && i < queryLabels.Count && i < queryOutputs.Count); 1062Contracts.Assert(0 <= j && j < queryLabels.Count && j < queryOutputs.Count); 1083Contracts.CheckValue(env, nameof(env));
Evaluators\RegressionEvaluator.cs (4)
74Contracts.CheckParam(schema.Label.HasValue, nameof(schema), "Could not find the label column"); 237Contracts.CheckValue(env, nameof(env)); 246Contracts.CheckValue(ctx, nameof(ctx)); 388Contracts.CheckValue(env, nameof(env));
Evaluators\RegressionEvaluatorBase.cs (4)
202Contracts.Assert(PassNum < 1); 203Contracts.Assert(schema.Label.HasValue); 209Contracts.AssertValue(_labelGetter); 210Contracts.AssertValue(_scoreGetter);
Model\ModelOperationsCatalog.cs (1)
27Contracts.AssertValue(env);
Model\Pfa\BoundPfaContext.cs (1)
47Contracts.CheckValue(env, nameof(env));
Model\Pfa\ModelUtils.cs (3)
27Contracts.Assert(1 < firstNonUpper && firstNonUpper <= name.Length); 36Contracts.CheckNonEmpty(name, nameof(name)); 37Contracts.CheckValue(contains, nameof(contains));
Model\Pfa\PfaContext.cs (5)
100Contracts.CheckValue(env, nameof(env)); 186Contracts.CheckValue(name, nameof(name)); 188throw Contracts.ExceptParam(nameof(name), $"Cell {name} already exists"); 189Contracts.CheckValue(type, nameof(type)); 190Contracts.CheckValue(init, nameof(init));
Model\Pfa\PfaUtils.cs (24)
17Contracts.CheckValueOrNull(toEdit); 18Contracts.CheckValue(name, nameof(name)); 19Contracts.CheckValue(value, nameof(value)); 35Contracts.CheckNonWhiteSpace(func, nameof(func)); 36Contracts.CheckValue(prms, nameof(prms)); 44Contracts.CheckNonWhiteSpace(func, nameof(func)); 67Contracts.CheckValue(str, nameof(str)); 114Contracts.CheckNonWhiteSpace(name, nameof(name)); 130Contracts.CheckValue(valueType, nameof(valueType)); 139Contracts.CheckValue(itemType, nameof(itemType)); 148Contracts.CheckParam(Utils.Size(types) >= 2, nameof(types), "Union must have at least two types"); 154Contracts.CheckValue(itemType, nameof(itemType)); 160Contracts.CheckValue(type, nameof(type)); 175Contracts.AssertValue(itemType); 227Contracts.CheckValue(itemType, nameof(itemType)); 274Contracts.CheckValue(ctx, nameof(ctx)); 275Contracts.CheckValue(itemType, nameof(itemType)); 289Contracts.CheckValue(ctx, nameof(ctx)); 300Contracts.CheckValue(ctx, nameof(ctx)); 335Contracts.CheckValue(ctx, nameof(ctx)); 336Contracts.AssertNonEmpty(funcPrefix); 337Contracts.AssertNonEmpty(binOp); 338Contracts.CheckValue(itemType, nameof(itemType)); 339Contracts.CheckValueOrNull(returnType);
Model\Pfa\SavePfaCommand.cs (2)
169Contracts.CheckUserArg(_loadPredictor != true, 176Contracts.CheckUserArg(_loadPredictor != true,
Prediction\Calibrator.cs (36)
214Contracts.CheckValue(env, nameof(env)); 310Contracts.AssertValue(Host); 442Contracts.CheckValue(ctx, nameof(ctx)); 462Contracts.CheckValue(ctx, nameof(ctx)); 512Contracts.CheckValue(env, nameof(env)); 589Contracts.CheckValue(env, nameof(env)); 623Contracts.Assert(model != null); 630Contracts.Assert(model != null); 661Contracts.AssertValue(env); 768Contracts.CheckValue(ctx, nameof(ctx)); 775Contracts.AssertValue(ctx); 910Contracts.CheckValue(env, nameof(env)); 942Contracts.CheckValue(env, nameof(env)); 1015Contracts.CheckValue(env, nameof(env)); 1031Contracts.Assert(predictor != null); 1094Contracts.CheckValue(env, nameof(env)); 1208Contracts.CheckValue(env, nameof(env)); 1217Contracts.CheckValue(env, nameof(env)); 1243Contracts.CheckValue(env, nameof(env)); 1377Contracts.CheckParam(capacity > 0, nameof(capacity), "must be positive"); 1431Contracts.CheckValue(env, nameof(env)); 1659Contracts.CheckValue(env, nameof(env)); 1709Contracts.CheckValue(env, nameof(env)); 1717Contracts.AssertValue(env); 1733Contracts.CheckValue(env, nameof(env)); 1859Contracts.Assert(minX <= maxX); 1861Contracts.Assert(0 <= value && value <= 1); 1862Contracts.Assert(n >= 0); 1976Contracts.AssertValue(env); 1994Contracts.AssertValue(env); 2038Contracts.CheckValue(env, nameof(env)); 2154Contracts.CheckValue(env, nameof(env)); 2165Contracts.CheckValue(env, nameof(env)); 2176Contracts.CheckValue(env, nameof(env)); 2187Contracts.CheckValue(env, nameof(env)); 2209Contracts.CheckValue(host, nameof(host));
Prediction\CalibratorCatalog.cs (4)
173: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(CalibratorTransformer<TICalibrator>))) 182: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(CalibratorTransformer<TICalibrator>))) 184Contracts.AssertValue(ctx); 214Contracts.AssertValue(ctx);
Prediction\PredictionEngine.cs (3)
24Contracts.AssertValue(env); 75Contracts.CheckValue(example, nameof(example)); 111Contracts.CheckValue(env, nameof(env));
Scorers\BinaryClassifierScorer.cs (14)
57Contracts.CheckValue(env, nameof(env)); 89Contracts.AssertValue(mapper); 90Contracts.AssertValue(labelNameType); 107Contracts.AssertValue(env); 128Contracts.CheckRef(args, nameof(args)).ThresholdColumn, OutputTypeMatches, GetPredColType) 130Contracts.CheckValue(args, nameof(args)); 131Contracts.CheckValue(data, nameof(data)); 132Contracts.CheckValue(mapper, nameof(mapper)); 146Contracts.AssertValue(ctx); 154Contracts.CheckDecode(cbFloat == sizeof(float)); 160Contracts.CheckValue(env, nameof(env)); 171Contracts.AssertValue(ctx); 226Contracts.CheckValue(env, nameof(env)); 285Contracts.CheckParam(Utils.Size(mapperOutputs) >= 1, nameof(mapperOutputs));
Scorers\ClusteringScorer.cs (10)
65Contracts.CheckValue(env, nameof(env)); 76Contracts.AssertValue(ctx); 87Contracts.CheckValue(env, nameof(env)); 88Contracts.CheckValue(newSource, nameof(newSource)); 95Contracts.AssertValue(output); 96Contracts.Assert(output.Schema == Bindings.RowMapper.OutputSchema); 97Contracts.Assert(output.IsColumnActive(output.Schema[Bindings.ScoreColumnIndex])); 110Contracts.Check(score.Length == scoreLength); 121Contracts.Check(score.Length == scoreLength); 131Contracts.Assert(Utils.Size(mapperOutputs) == 1);
Scorers\FeatureContributionCalculation.cs (22)
58Contracts.CheckValue(env, nameof(env)); 77Contracts.CheckValue(env, nameof(env)); 121Contracts.CheckValue(env, nameof(env)); 140Contracts.CheckValue(env, nameof(env)); 155Contracts.CheckDecode(0 <= _topContributionsCount); 157Contracts.CheckDecode(0 <= _bottomContributionsCount); 164Contracts.CheckValue(env, nameof(env)); 172Contracts.CheckValue(ctx, nameof(ctx)); 183Contracts.Assert(0 <= _topContributionsCount); 185Contracts.Assert(0 <= _bottomContributionsCount); 193Contracts.CheckValue(input, nameof(input)); 194Contracts.Check(0 <= colSrc && colSrc < input.Schema.Count); 204Contracts.CheckValue(input, nameof(input)); 205Contracts.Check(0 <= colSrc && colSrc < input.Schema.Count); 225Contracts.AssertValue(input); 226Contracts.AssertValue(Predictor); 264Contracts.AssertValue(input); 265Contracts.AssertValue(Predictor); 284Contracts.AssertValue(ectx); 315Contracts.AssertValue(env); 366Contracts.AssertValue(input); 367Contracts.AssertValue(activeColumns);
Scorers\GenericScorer.cs (20)
44Contracts.Assert(DerivedColumnCount == 0); 52Contracts.AssertValue(input); 53Contracts.AssertValue(mapper); 54Contracts.AssertValueOrNull(suffix); 57Contracts.Assert(mapper.InputSchema == input); 68Contracts.AssertValue(env); 69Contracts.AssertValue(bindable); 70Contracts.AssertValue(input); 71Contracts.AssertValue(roles); 72Contracts.AssertValueOrNull(suffix); 77Contracts.Assert(mapper.InputRoleMappedSchema.Schema == input); 80Contracts.Check(rowMapper != null, "Predictor expected to be a RowMapper!"); 91Contracts.AssertValue(input); 92Contracts.AssertValue(env); 106Contracts.AssertValue(ctx); 118Contracts.AssertValue(ctx); 155: base(env, data, RegistrationName, Contracts.CheckRef(mapper, nameof(mapper)).Bindable) 183Contracts.AssertValue(ctx); 193Contracts.CheckValue(env, nameof(env)); 205Contracts.AssertValue(ctx);
Scorers\MulticlassClassificationScorer.cs (28)
116Contracts.AssertValue(env); 133Contracts.AssertValue(host); 163Contracts.CheckValue(env, nameof(env)); 178Contracts.CheckValue(ctx, nameof(ctx)); 193Contracts.Assert(_type.ItemType.RawType == typeof(T)); 194Contracts.Assert(_getter is ValueGetter<VBuffer<T>>); 213Contracts.CheckValue(ctx, nameof(ctx)); 214Contracts.CheckValue(schema, nameof(schema)); 215Contracts.Check(((ICanSavePfa)this).CanSavePfa, "Cannot be saved as PFA"); 216Contracts.Assert(_bindable is IBindableCanSavePfa); 222Contracts.CheckValue(ctx, nameof(ctx)); 223Contracts.CheckValue(schema, nameof(schema)); 224Contracts.Check(((ICanSaveOnnx)this).CanSaveOnnx(ctx), "Cannot be saved as ONNX."); 225Contracts.Assert(_bindable is IBindableCanSaveOnnx); 234Contracts.Assert(innerBound is ISchemaBoundRowMapper); 241Contracts.AssertValue(env); 285Contracts.CheckValue(env, nameof(env)); 362Contracts.AssertValue(row); 363Contracts.AssertValue(schema); 407Contracts.CheckValue(env, nameof(env)); 447Contracts.AssertValue(mapper); 448Contracts.AssertValue(labelNameType); 487Contracts.AssertValue(env); 535Contracts.CheckValue(env, nameof(env)); 545Contracts.AssertValue(ctx); 556Contracts.CheckValue(env, nameof(env)); 557Contracts.CheckValue(newSource, nameof(newSource)); 599Contracts.Assert(Utils.Size(mapperOutputs) == 1);
Scorers\PredictedLabelScorerBase.cs (19)
56Contracts.AssertNonEmpty(scoreColumnKind); 57Contracts.Assert(DerivedColumnCount == 1); 77Contracts.Assert(trainLabelColVecType.Size > 0); 86Contracts.AssertValue(meta); 87Contracts.Assert(metaCol.Type.RawType == typeof(T)); 96Contracts.AssertValue(input); 97Contracts.AssertValue(mapper); 98Contracts.AssertValueOrNull(suffix); 99Contracts.AssertNonEmpty(scoreColKind); 107Contracts.AssertValue(env); 129Contracts.AssertValue(env); 160Contracts.AssertValue(ctx); 173Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 181Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 204Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 248Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 255Contracts.Assert(0 <= iinfo && iinfo < DerivedColumnCount); 261Contracts.Assert(DerivedColumnCount == 1); 285: base(env, data, registrationName, Contracts.CheckRef(mapper, nameof(mapper)).Bindable)
Scorers\PredictionTransformer.cs (24)
83Contracts.CheckValue(host, nameof(host)); 324: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(AnomalyPredictionTransformer<TModel>)), model, inputSchema, featureColumn) 334: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(AnomalyPredictionTransformer<TModel>)), ctx) 355Contracts.AssertValue(ctx); 394: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(BinaryPredictionTransformer<TModel>)), model, inputSchema, featureColumn) 405: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(BinaryPredictionTransformer<TModel>)), model, inputSchema, featureColumn) 415: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(BinaryPredictionTransformer<TModel>)), ctx) 447Contracts.AssertValue(ctx); 486base(Contracts.CheckRef(env, nameof(env)).Register(nameof(MulticlassPredictionTransformer<TModel>)), model, inputSchema, featureColumn) 497: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(MulticlassPredictionTransformer<TModel>)), ctx) 539Contracts.AssertValue(ctx); 574: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(RegressionPredictionTransformer<TModel>)), model, inputSchema, featureColumn) 580: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(RegressionPredictionTransformer<TModel>)), ctx) 593Contracts.AssertValue(ctx); 622: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(RankingPredictionTransformer<TModel>)), model, inputSchema, featureColumn) 628: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(RankingPredictionTransformer<TModel>)), ctx) 641Contracts.AssertValue(ctx); 671: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ClusteringPredictionTransformer<TModel>)), model, inputSchema, featureColumn) 681: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ClusteringPredictionTransformer<TModel>)), ctx) 693Contracts.AssertValue(ctx); 722var host = Contracts.CheckRef(env, nameof(env)).Register(nameof(BinaryPredictionTransformer<IPredictorProducing<float>>)); 739var host = Contracts.CheckRef(env, nameof(env)).Register(nameof(MulticlassPredictionTransformer<IPredictorProducing<VBuffer<float>>>)); 756var host = Contracts.CheckRef(env, nameof(env)).Register(nameof(RegressionPredictionTransformer<IPredictorProducing<float>>)); 774var host = Contracts.CheckRef(env, nameof(env)).Register(nameof(RankingPredictionTransformer<IPredictorProducing<float>>));
Scorers\QuantileRegressionScorer.cs (5)
42Contracts.CheckValue(env, nameof(env)); 55Contracts.CheckUserArg(quantiles != null, nameof(Arguments.Quantiles), "Quantiles are required"); 61throw Contracts.ExceptUserArg(nameof(Arguments.Quantiles), "Cannot parse quantile '{0}' as double.", v); 62Contracts.CheckUserArg(0 <= q && q <= 1, nameof(Arguments.Quantiles), "Quantile must be between 0 and 1."); 65Contracts.CheckUserArg(quantilesArray.Length > 0, nameof(Arguments.Quantiles), "There must be at least one quantile.");
Scorers\RowToRowScorerBase.cs (32)
44Contracts.AssertValue(bindable); 57Contracts.AssertValue(ctx); 91Contracts.Assert(active.Length == bindings.ColumnCount); 94Contracts.Assert(activeInput.Length == bindings.Input.Count); 131Contracts.AssertValueOrNull(rand); 153Contracts.AssertNonEmpty(inputs); 157Contracts.AssertNonEmpty(inputs); 192Contracts.AssertValue(row); 193Contracts.AssertValue(predicate); 206Contracts.AssertValue(row); 207Contracts.Assert(0 <= col && col < row.Schema.Count); 208Contracts.Assert(row.IsColumnActive(row.Schema[col])); 216Contracts.AssertValue(output); 217Contracts.Assert(0 <= col && col < output.Schema.Count); 218Contracts.Assert(output.IsColumnActive(output.Schema[col])); 348Contracts.AssertValue(mapper); 349Contracts.AssertValueOrNull(suffix); 350Contracts.AssertValue(namesDerived); 364Contracts.AssertValue(mapper); 365Contracts.AssertValueOrNull(suffix); 366Contracts.AssertValue(namesDerived); 376Contracts.Assert(dst == count); 392Contracts.CheckDecode(count >= 0); 407Contracts.AssertValue(ctx); 430Contracts.Assert(DerivedColumnCount <= iinfo && iinfo < InfoCount); 436Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 447Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 457Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 477Contracts.AssertValue(active); 478Contracts.Assert(active.Length == ColumnCount); 483Contracts.Assert(0 <= col && col < Mapper.OutputSchema.Count); 491Contracts.Assert(0 <= iinfo && iinfo < InfoCount);
Scorers\SchemaBindablePredictorWrapper.cs (81)
54Contracts.CheckValue(predictor, nameof(predictor)); 61Contracts.AssertValue(predictor); 66throw Contracts.Except( 72Contracts.AssertValue(ctx); 85Contracts.CheckValue(ctx, nameof(ctx)); 96Contracts.CheckValue(ctx, nameof(ctx)); 97Contracts.CheckValue(schema, nameof(schema)); 98Contracts.Assert(ValueMapper is ISingleCanSavePfa); 110Contracts.CheckValue(ctx, nameof(ctx)); 111Contracts.CheckValue(schema, nameof(schema)); 112Contracts.Assert(ValueMapper is ISingleCanSaveOnnx); 122Contracts.CheckValue(env, nameof(env)); 159Contracts.AssertValue(input); 160Contracts.Assert(0 <= colSrc && colSrc < input.Schema.Count); 168Contracts.AssertValue(input); 169Contracts.Assert(ValueMapper != null); 207Contracts.AssertValue(schema); 208Contracts.AssertValue(parent); 209Contracts.Assert(schema.Feature.HasValue); 210Contracts.Assert(outputSchema.Count == 1); 237Contracts.AssertValue(input); 238Contracts.AssertValue(activeColumns); 311Contracts.CheckValue(env, nameof(env)); 319Contracts.CheckValue(ctx, nameof(ctx)); 326Contracts.CheckValue(ctx, nameof(ctx)); 327Contracts.CheckValue(schema, nameof(schema)); 328Contracts.Assert(ValueMapper is ISingleCanSavePfa); 329Contracts.Assert(schema.Feature.HasValue); 330Contracts.Assert(Utils.Size(outputNames) == 1); // Score. 342Contracts.CheckValue(ctx, nameof(ctx)); 343Contracts.CheckValue(schema, nameof(schema)); 344Contracts.Assert(ValueMapper is ISingleCanSaveOnnx); 345Contracts.Assert(schema.Feature.HasValue); 346Contracts.Assert(Utils.Size(outputNames) <= 2); // PredictedLabel and/or Score. 351Contracts.Assert(ctx.ContainsColumn(featName)); 360Contracts.AssertValue(predictor); 379throw Contracts.Except("Unknown prediction kind, can't map to score column kind: {0}", predictor.PredictionKind); 419Contracts.CheckValue(ctx, nameof(ctx)); 426Contracts.CheckValue(ctx, nameof(ctx)); 433Contracts.CheckValue(ctx, nameof(ctx)); 434Contracts.CheckValue(schema, nameof(schema)); 435Contracts.Assert(ValueMapper is IDistCanSavePfa); 436Contracts.Assert(schema.Feature.HasValue); 437Contracts.Assert(Utils.Size(outputNames) == 2); // Score and prob. 447Contracts.Assert(ctx.TokenOrNullForName(outputNames[0]) == scoreToken.ToString()); 448Contracts.Assert(ctx.TokenOrNullForName(outputNames[1]) == probToken.ToString()); 453Contracts.CheckValue(ctx, nameof(ctx)); 454Contracts.CheckValue(schema, nameof(schema)); 457Contracts.CheckValue(mapper, nameof(mapper)); 458Contracts.Assert(Utils.Size(outputNames) == 3); // Predicted Label, Score and Probability. 463Contracts.Assert(schema.Label.HasValue); 471Contracts.Assert(ctx.ContainsColumn(featName)); 477Contracts.Check(ScoreType == NumberDataViewType.Single, "Expected predictor result type to be float"); 481throw Contracts.Except("Predictor does not provide probabilities"); 486Contracts.Check(distMapper.InputType is VectorDataViewType vectorType && vectorType.ItemType == NumberDataViewType.Single, 488Contracts.Check(distMapper.DistType == NumberDataViewType.Single, 498Contracts.AssertValue(_distMapper); 519Contracts.AssertValue(parent); 520Contracts.Assert(parent._distMapper != null); 521Contracts.AssertValue(schema); 529Contracts.Check(typeSrc is VectorDataViewType vectorType 555Contracts.Assert(Utils.Size(active) == 2); 556Contracts.Assert(_parent._distMapper != null); 598Contracts.AssertValue(mapper); 611Contracts.AssertValue(input); 646Contracts.CheckParam(qpred != null, nameof(predictor), "Predictor doesn't implement " + nameof(IQuantileValueMapper)); 648Contracts.CheckParam(ScoreType == NumberDataViewType.Single, nameof(predictor), "Unexpected predictor output type"); 649Contracts.CheckParam(ValueMapper != null && ValueMapper.InputType is VectorDataViewType vectorType 652Contracts.CheckNonEmpty(quantiles, nameof(quantiles), "Quantiles must not be empty"); 665Contracts.CheckDecode(qpred != null); 667Contracts.CheckDecode(ScoreType == NumberDataViewType.Single); 668Contracts.CheckDecode(ValueMapper != null && ValueMapper.InputType is VectorDataViewType vectorType 671Contracts.CheckDecode(Utils.Size(_quantiles) > 0); 676Contracts.CheckValue(ctx, nameof(ctx)); 690Contracts.CheckValue(ctx, nameof(ctx)); 700Contracts.AssertValue(input); 701Contracts.Assert(0 <= colSrc && colSrc < input.Schema.Count); 705Contracts.Assert(typeSrc != null && typeSrc.ItemType == NumberDataViewType.Single); 706Contracts.Assert(ValueMapper == null || 708Contracts.Assert(Utils.Size(_quantiles) > 0); 723Contracts.Check(features.Length == featureCount || featureCount == 0);
Scorers\ScoreSchemaFactory.cs (7)
25Contracts.CheckValue(scoreType, nameof(scoreType)); 26Contracts.CheckNonEmpty(scoreColumnKindValue, nameof(scoreColumnKindValue)); 82Contracts.CheckValue(scoreType, nameof(scoreType)); 83Contracts.CheckValue(scoreType as PrimitiveDataViewType, nameof(scoreType)); 84Contracts.AssertValue(quantiles); 119Contracts.CheckValue(scoreType, nameof(scoreType)); 120Contracts.CheckValue(scoreColumnKindValue, nameof(scoreColumnKindValue));
TrainCatalog.cs (1)
137Contracts.CheckValue(env, nameof(env));
Training\TrainerEstimatorBase.cs (2)
63Contracts.CheckValue(host, nameof(host)); 135Contracts.CheckParam(labelCol.IsValid, nameof(labelCol), "not initialized properly");
Training\TrainerUtils.cs (70)
51Contracts.CheckValue(data, nameof(data)); 54throw Contracts.ExceptParam(nameof(data), "Training data must specify a feature column."); 56Contracts.Assert(!col.IsHidden); 58throw Contracts.ExceptParam(nameof(data), "Training feature column '{0}' must be a known-size vector of R4, but has type: {1}.", col.Name, col.Type); 69Contracts.AssertValue(data); 70Contracts.Assert(data.Schema.Feature.HasValue); 72Contracts.Assert(!col.IsHidden); 74Contracts.Assert(colType != null && colType.IsKnownSize); 75Contracts.Assert(colType.ItemType == NumberDataViewType.Single); 84Contracts.CheckValue(data, nameof(data)); 87throw Contracts.ExceptParam(nameof(data), "Training data must specify a label column."); 89Contracts.Assert(!col.IsHidden); 97throw Contracts.ExceptParam(nameof(data), 103throw Contracts.ExceptParam(nameof(data), 108throw Contracts.ExceptParam(nameof(data), 119Contracts.CheckValue(data, nameof(data)); 122throw Contracts.ExceptParam(nameof(data), "Training data must specify a label column."); 124Contracts.Assert(!data.Schema.Schema[col.Index].IsHidden); 127throw Contracts.ExceptParam(nameof(data), 139Contracts.CheckValue(data, nameof(data)); 142throw Contracts.ExceptParam(nameof(data), "Training data must specify a label column."); 144Contracts.Assert(!col.IsHidden); 148throw Contracts.ExceptParam(nameof(data), "Maximum label is too large for multi-class: {0}.", keyType.Count); 155throw Contracts.ExceptParam(nameof(data), "Training label column '{0}' type is not valid for multi-class: {1}. Type must be Single or Double.", col.Name, col.Type); 165throw Contracts.ExceptParam(nameof(data), 174throw Contracts.ExceptParam(nameof(data), "Training label column '{0}' contains no valid values for multi-class.", col.Name); 177throw Contracts.ExceptParam(nameof(data), "Maximum label is too large for multi-class: {0}.", max); 187Contracts.CheckValue(data, nameof(data)); 190throw Contracts.ExceptParam(nameof(data), "Training data must specify a label column."); 192Contracts.Assert(!col.IsHidden); 196throw Contracts.ExceptParam(nameof(data), "Training label column '{0}' must be a known-size vector of Single, but has type: {1}.", col.Name, col.Type); 201Contracts.CheckValue(data, nameof(data)); 206Contracts.Assert(!col.IsHidden); 208throw Contracts.ExceptParam(nameof(data), "Training weight column '{0}' must be of floating point numeric type, but has type: {1}.", col.Name, col.Type); 213Contracts.CheckValue(data, nameof(data)); 218Contracts.Assert(!col.IsHidden); 221throw Contracts.ExceptParam(nameof(data), "Training group column '{0}' type is invalid: {1}. Must be Key type.", col.Name, col.Type); 226Contracts.AssertValue(data); 227Contracts.AssertValueOrNull(extraCols); 264Contracts.CheckValue(row, nameof(row)); 265Contracts.CheckValue(schema, nameof(schema)); 266Contracts.CheckParam(schema.Schema == row.Schema, nameof(schema), "schemas don't match!"); 267Contracts.CheckParam(schema.Feature.HasValue, nameof(schema), "Missing feature column"); 277Contracts.CheckValue(data, nameof(data)); 287Contracts.CheckValue(row, nameof(row)); 288Contracts.CheckValue(schema, nameof(schema)); 289Contracts.CheckParam(schema.Schema == row.Schema, nameof(schema), "schemas don't match!"); 290Contracts.CheckParam(schema.Label.HasValue, nameof(schema), "Missing label column"); 301Contracts.CheckValue(data, nameof(data)); 310Contracts.CheckValue(row, nameof(row)); 311Contracts.CheckValue(schema, nameof(schema)); 312Contracts.Check(schema.Schema == row.Schema, "schemas don't match!"); 322Contracts.CheckValue(data, nameof(data)); 331Contracts.CheckValue(row, nameof(row)); 332Contracts.CheckValue(schema, nameof(schema)); 333Contracts.Check(schema.Schema == row.Schema, "schemas don't match!"); 343Contracts.CheckValue(data, nameof(data)); 410Contracts.AssertValue(env); 508Contracts.AssertValue(input); 509Contracts.AssertValueOrNull(signal); 516Contracts.AssertValue(data); 517Contracts.AssertValueOrNull(rand); 603Contracts.CheckValue(data, nameof(data)); 653Contracts.Assert(Utils.Size(inputs) > 0); 696Contracts.AssertValue(signal); 697Contracts.Assert(lim > 0); 707Contracts.Assert(_count < _lim); 744Contracts.AssertValue(data); 970Contracts.Assert(classCount >= 0); 1012Contracts.CheckParamValue(classCount >= 0, classCount, nameof(classCount), "Must be non-negative");
Transforms\BootstrapSamplingTransformer.cs (2)
155Contracts.CheckValue(env, nameof(env)); 256Contracts.CheckValue(env, nameof(env));
Transforms\CatalogUtils.cs (1)
15public static IHostEnvironment GetEnvironment(this IInternalCatalog catalog) => Contracts.CheckRef(catalog, nameof(catalog)).Environment;
Transforms\ColumnBindingsBase.cs (71)
37Contracts.AssertNonEmpty(str); 51Contracts.AssertNonEmpty(str); 61Contracts.AssertValue(sb); 80Contracts.AssertValue(sb); 81Contracts.AssertNonEmpty(extra); 134Contracts.AssertNonEmpty(str); 164Contracts.AssertNonEmpty(str); 199Contracts.AssertValue(sb); 224Contracts.AssertNonEmpty(extra); 275Contracts.CheckValue(inputBindings, nameof(inputBindings)); 306Contracts.CheckValue(input, nameof(input)); 307Contracts.CheckNonEmpty(names, nameof(names)); 317Contracts.Assert(nameof(ValueToKeyMappingTransformer.Options.Columns) == standardColumnArgName); 318Contracts.Assert(nameof(ColumnConcatenatingTransformer.Options.Columns) == standardColumnArgName); 327Contracts.ExceptUserArg(standardColumnArgName, "New column needs a name") : 329Contracts.ExceptDecode("New column needs a name"); 335Contracts.ExceptUserArg(standardColumnArgName, "New column '{0}' specified multiple times", name) : 337Contracts.ExceptDecode("New column '{0}' specified multiple times", name); 341Contracts.Assert(_nameToInfoIndex.Count == names.Length); 360Contracts.Check(0 <= colHidden && colHidden < input.Count); 362Contracts.Check(str == name); 363Contracts.Check(colMap[colHidden] == 0); 373Contracts.Assert(mapIinfoToCol[iinfo] <= 0); 382Contracts.Assert(colMap[colSrc] <= 0); 385Contracts.Assert(colDst > 1); 387Contracts.Assert(0 <= iinfo && iinfo < names.Length); 388Contracts.Assert(mapIinfoToCol[iinfo] == ~colSrc); 392Contracts.Assert(colDst > 0); 395Contracts.Assert(colDst == 0); 419Contracts.Assert(0 <= col && col < _colMap.Length); 424Contracts.Assert(0 <= index && index < InfoCount); 429Contracts.Assert(index < Input.Count); 442Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 448Contracts.CheckValueOrNull(name); 458Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 469Contracts.Assert(0 <= src && src < Input.Count); 473Contracts.Assert(0 <= res && res < ColumnCount); 474Contracts.Assert(_colMap[res] <= src); 489Contracts.CheckParam(0 <= col && col < ColumnCount, nameof(col)); 500Contracts.CheckParam(0 <= col && col < ColumnCount, nameof(col)); 511Contracts.CheckParam(0 <= col && col < ColumnCount, nameof(col)); 517Contracts.Assert(0 <= index && index < InfoCount); 523Contracts.CheckNonEmpty(kind, nameof(kind)); 524Contracts.CheckParam(0 <= col && col < ColumnCount, nameof(col)); 530Contracts.Assert(0 <= index && index < InfoCount); 536Contracts.CheckNonEmpty(kind, nameof(kind)); 537Contracts.CheckParam(0 <= col && col < ColumnCount, nameof(col)); 545Contracts.Assert(0 <= index && index < InfoCount); 552Contracts.AssertValue(name); 558Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 566Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 572Contracts.AssertNonEmpty(kind); 573Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 579Contracts.AssertNonEmpty(kind); 580Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 605Contracts.AssertValue(predicate); 611Contracts.Assert(-InfoCount <= src && src < Input.Count); 624Contracts.AssertValue(inputColumns); 635Contracts.AssertValue(predicate); 681Contracts.CheckValue(input, nameof(input)); 682Contracts.CheckValue(addedColumns, nameof(addedColumns)); 717Contracts.Assert(indices.Count == addedColumns.Length + input.Count); 731Contracts.Assert(addedIndices[~colIndex] == 0); 749Contracts.Assert(0 <= col && col < _colMap.Length); 754Contracts.Assert(index < AddedColumnIndices.Count); 759Contracts.Assert(index < InputSchema.Count); 772Contracts.AssertValue(predicate); 778Contracts.Assert(-AddedColumnIndices.Count <= src && src < InputSchema.Count); 798Contracts.CheckNonWhiteSpace(str, nameof(str)); 826Contracts.CheckNonWhiteSpace(str, nameof(str)); 847Contracts.Assert(ich >= ichMin - 1);
Transforms\ColumnConcatenatingEstimator.cs (1)
53Contracts.CheckValue(env, nameof(env));
Transforms\ColumnConcatenatingTransformer.cs (55)
51Contracts.AssertNonEmpty(str); 60Contracts.AssertValue(sb); 81Contracts.AssertNonEmpty(str); 86Contracts.AssertValue(res.Source); 95Contracts.AssertValue(sb); 150Contracts.CheckValue(inputColumnNames, nameof(inputColumnNames)); 161Contracts.CheckNonEmpty(name, nameof(name)); 162Contracts.CheckValue(inputColumnNames, nameof(inputColumnNames)); 163Contracts.CheckParam(inputColumnNames.Any(), nameof(inputColumnNames), "Can not be empty"); 167Contracts.CheckNonEmpty(output, nameof(inputColumnNames)); 168Contracts.CheckValueOrNull(alias); 177Contracts.AssertValue(ctx); 186Contracts.Assert(_sources.Length > 0); 197Contracts.AssertValue(ctx); 207Contracts.CheckDecode(n > 0); 240base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ColumnConcatenatingTransformer))) 242Contracts.CheckValue(columns, nameof(columns)); 274Contracts.Assert(_columns.Length > 0); 284base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ColumnConcatenatingTransformer))) 295Contracts.CheckDecode(n > 0); 321Contracts.CheckDecode(sizeofFloat == sizeof(float)); 324Contracts.CheckDecode(n > 0); 331Contracts.CheckDecode(numSources > 0); 351Contracts.CheckDecode(0 <= j && j < length); 352Contracts.CheckDecode(aliases[i][j] == null); 371Contracts.CheckValue(env, nameof(env)); 391Contracts.CheckValue(env, nameof(env)); 429base(Contracts.CheckRef(parent, nameof(parent)).Host.Register(nameof(Mapper)), inputSchema, parent) 442Contracts.AssertValue(inputSchema); 443Contracts.Assert(0 <= iinfo && iinfo < _parent._columns.Length); 497Contracts.Assert(typeCat.Length > 0); 599Contracts.Assert(_srcTypes[i].GetValueCount() > 0); 606Contracts.Assert(values.Length > 0 && values.Length % 2 == 0); 613Contracts.Assert(allValues.Count > 0); 620Contracts.Assert(!_isIdentity); 621Contracts.Assert(OutputType.Size > 0); 623Contracts.AssertValue(_slotNamesType); 624Contracts.Assert(_slotNamesType.Size == OutputType.Size); 636Contracts.Assert(_columnOptions.Sources[i].alias != ""); 645Contracts.Assert(vectorTypeSrc.IsKnownSize); 670Contracts.Assert(slot == OutputType.Size); 685Contracts.Assert(SrcIndices.Length == 1); 718throw Contracts.Except("Column '{0}': expected {1} slots, but got {2}", 741Contracts.Assert(offset < dstLength); 746Contracts.Assert(bufferValues.Length <= dstCount - count); 747Contracts.Assert(buffer.Length <= dstLength - offset); 769Contracts.Assert(count < dstCount); 776Contracts.Assert(count <= dstCount); 777Contracts.Assert(offset == dstLength); 788Contracts.Assert(tmpBufs[j].Length <= dstLength - offset); 800Contracts.Assert(offset == dstLength); 809Contracts.AssertValue(ctx); 823Contracts.Assert(srcTokens.All(tok => tok != null)); 852Contracts.AssertValue(result); 903Contracts.Assert(CanSaveOnnx(ctx));
Transforms\ColumnCopying.cs (6)
64: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ColumnCopyingEstimator)), new ColumnCopyingTransformer(env, columns)) 116: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ColumnCopyingTransformer)), columns) 124Contracts.AssertNonEmpty(str); 134Contracts.AssertValue(sb); 149Contracts.CheckValue(env, nameof(env)); 159Contracts.CheckValue(env, nameof(env));
Transforms\ColumnSelecting.cs (11)
98: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ColumnSelectingEstimator)), 227_host = Contracts.CheckRef(env, nameof(env)).Register(nameof(ColumnSelectingTransformer)); 279Contracts.CheckDecode(count > 0); 285Contracts.CheckDecode(names.Add(name)); 345Contracts.Assert(Enum.IsDefined(typeof(HiddenColumnOption), hiddenOption)); 350Contracts.CheckDecode(count >= 0); 357Contracts.CheckDecode(names.Add(dst)); 361Contracts.Assert(Enum.IsDefined(typeof(HiddenColumnOption), colHiddenOption)); 404Contracts.CheckValue(env, nameof(env)); 436Contracts.CheckValue(env, nameof(env)); 661_host = Contracts.CheckRef(env, nameof(env)).Register(nameof(SelectColumnsDataTransform));
Transforms\ExtensionsCatalog.cs (1)
38Contracts.CheckNonEmpty(outputColumnName, nameof(outputColumnName));
Transforms\FeatureContributionCalculationTransformer.cs (12)
90: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(FeatureContributionCalculatingTransformer)), new[] { (name: DefaultColumnNames.FeatureContributions, source: featureColumnName) }) 110: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(FeatureContributionCalculatingTransformer)), ctx) 123Contracts.CheckDecode(0 <= Top); 125Contracts.CheckDecode(0 <= Bottom); 143Contracts.Assert(0 <= Top); 145Contracts.Assert(0 <= Bottom); 153Contracts.CheckValue(env, nameof(env)); 206Contracts.CheckValue(input, nameof(input)); 215Contracts.AssertValue(input); 216Contracts.AssertValue(_parent._predictor); 327: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(FeatureContributionCalculatingTransformer)), 369Contracts.CheckValue(env, nameof(env));
Transforms\GenerateNumberTransform.cs (16)
48Contracts.AssertNonEmpty(str); 58Contracts.AssertNonEmpty(str); 109Contracts.Assert(Utils.Size(useCounter) == InfoCount); 110Contracts.Assert(Utils.Size(states) == InfoCount); 134Contracts.AssertValue(ctx); 135Contracts.AssertValue(input); 148Contracts.CheckDecode(size > 0); 166Contracts.AssertValue(ctx); 192Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 198Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 207Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 215Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 227Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 233Contracts.AssertValue(predicate); 236Contracts.Assert(active.Length == Input.Count); 302Contracts.CheckValue(env, nameof(env));
Transforms\Hashing.cs (39)
83Contracts.AssertNonEmpty(str); 93Contracts.AssertNonEmpty(str); 111Contracts.AssertValue(sb); 157Contracts.CheckNonEmpty(columns, nameof(columns)); 179base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), GetColumnPairs(columns)) 193base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), GetColumnPairs(columns)) 280Contracts.CheckValue(env, nameof(env)); 329Contracts.CheckValue(env, nameof(env)); 1000Contracts.Assert(Utils.IsPowerOfTwo(mask + 1)); 1001Contracts.AssertValue(input); 1002Contracts.Assert(0 <= srcCol && srcCol < input.Schema.Count); 1003Contracts.Assert(input.Schema[srcCol].Type.RawType == typeof(T)); 1026Contracts.Assert(Utils.IsPowerOfTwo(mask + 1)); 1027Contracts.AssertValue(srcGetter); 1144Contracts.Assert(Utils.IsPowerOfTwo(mask + 1)); 1145Contracts.AssertValue(srcGetter); 1208Contracts.Assert(false, "this should have never happened."); 1272Contracts.Assert(false, "this should have never happened."); 1282Contracts.Assert(Utils.IsPowerOfTwo(mask + 1)); 1283Contracts.AssertValue(input); 1489Contracts.AssertValue(row); 1574Contracts.Assert(_srcType.GetItemType().RawType == typeof(T)); 1599Contracts.AssertValue(row); 1600Contracts.AssertValue(ex); 1634Contracts.AssertValue(_dstGetter); 1668Contracts.AssertValue(_dstGetter); 1680Contracts.Assert(_value.IsDense == _hash.IsDense); 1681Contracts.Assert(_value.Length == _hash.Length); 1682Contracts.Assert(valueValues.Length == hashValues.Length); 1702Contracts.AssertValue(_dstGetter); 1725Contracts.Assert(_value.IsDense == _hash.IsDense); 1726Contracts.Assert(_value.Length == _hash.Length); 1727Contracts.Assert(valueValues.Length == hashValues.Length); 1839throw Contracts.ExceptParam(nameof(maximumNumberOfInverts), "Value too small, must be -1 or larger"); 1841throw Contracts.ExceptParam(nameof(numberOfBits), $"Cannot support maximumNumberOfInverts for a {0} bit hash. 30 is the maximum possible.", numberOfBits); 1842Contracts.CheckNonWhiteSpace(name, nameof(name)); 1864Contracts.CheckDecode(NumBitsMin <= NumberOfBits && NumberOfBits < NumBitsLim); 1879Contracts.Assert(NumBitsMin <= NumberOfBits && NumberOfBits < NumBitsLim); 1930Contracts.CheckValue(env, nameof(env));
Transforms\InvertHashUtils.cs (25)
23Contracts.AssertValueOrNull(dst); 37Contracts.AssertValue(schema); 38Contracts.Assert(0 <= col && col < schema.Count); 40Contracts.Assert(type.RawType == typeof(T)); 119Contracts.Assert(order >= 0); 173Contracts.Assert(slots > 0); 174Contracts.Assert(maxCount > 0); 175Contracts.AssertValue(mapper); 176Contracts.AssertValue(comparer); 188Contracts.AssertValueOrNull(sb); 189Contracts.AssertValueOrNull(temp); 190Contracts.AssertValueOrNull(cbuffer); 191Contracts.AssertValueOrNull(buffer); 192Contracts.Assert(Utils.Size(pairs) > 0); 211Contracts.Assert(sb.Length == 0); 232Contracts.Assert(count <= _slots); 247Contracts.Assert(0 <= p.Key && p.Key < _slots); 251Contracts.Assert(i == count); 261Contracts.Assert(0 <= p.Key && p.Key < _slots); 273Contracts.Assert(0 <= dstSlot && dstSlot < _slots); 288Contracts.Assert(0 <= dstSlot && dstSlot < _slots); 341Contracts.AssertValue(ch); 381Contracts.AssertValue(ch); 446Contracts.AssertValue(host); 480Contracts.AssertValue(host);
Transforms\KeyToValue.cs (10)
51Contracts.AssertValue(sb); 94: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(KeyToValueMappingTransformer)), columns) 104Contracts.CheckValue(env, nameof(env)); 118Contracts.CheckValue(env, nameof(env)); 228Contracts.Assert(types[iinfo] == null); 291Contracts.AssertValue(mapper); 464Contracts.AssertValue(ctx); 465Contracts.AssertValue(srcToken); 621: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(KeyToValueMappingEstimator)), new KeyToValueMappingTransformer(env, outputColumnName, inputColumnName ?? outputColumnName)) 626: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(KeyToValueMappingEstimator)), new KeyToValueMappingTransformer(env, columns))
Transforms\KeyToVector.cs (18)
50Contracts.AssertValue(sb); 58Contracts.AssertValue(sb); 59Contracts.AssertNonEmpty(extra); 71Contracts.AssertNonEmpty(str); 81Contracts.AssertValue(sb); 103Contracts.CheckValue(columns, nameof(columns)); 123base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), GetColumnPairs(columns)) 163Contracts.CheckValue(env, nameof(env)); 195Contracts.CheckValue(env, nameof(env)); 378Contracts.AssertValue(inputMetadata); 405Contracts.Assert(slot == (long)kvpSlot.Key * keyCount); 662Contracts.AssertValue(ctx); 663Contracts.Assert(0 <= iinfo && iinfo < _infos.Length); 664Contracts.Assert(_infos[iinfo] == info); 665Contracts.AssertValue(srcToken); 666Contracts.Assert(CanSavePfa); 792Contracts.CheckNonWhiteSpace(name, nameof(name)); 810: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(KeyToVectorMappingEstimator)), transformer)
Transforms\LabelConvertTransform.cs (14)
31Contracts.AssertNonEmpty(str); 41Contracts.AssertValue(sb); 83: base(env, RegistrationName, Contracts.CheckRef(args, nameof(args)).Columns, input, RowCursorUtils.TestGetLabelGetter) 85Contracts.AssertNonEmpty(Infos); 86Contracts.Assert(Infos.Length == Utils.Size(args.Columns)); 93Contracts.AssertValue(ctx); 104Contracts.CheckValue(env, nameof(env)); 139Contracts.Assert(0 <= iinfo && iinfo < Infos.Length); 161Contracts.AssertNonEmpty(kind); 162Contracts.Assert(0 <= iinfo && iinfo < Infos.Length); 172Contracts.AssertValueOrNull(ch); 173Contracts.AssertValue(input); 174Contracts.Assert(0 <= iinfo && iinfo < Infos.Length); 179Contracts.Assert(RowCursorUtils.TestGetLabelGetter(typeSrc) == null);
Transforms\LabelIndicatorTransform.cs (6)
54Contracts.AssertNonEmpty(str); 64Contracts.AssertValue(sb); 81Contracts.CheckValue(env, nameof(env)); 92Contracts.CheckValue(env, nameof(env)); 134: base(env, LoadName, Contracts.CheckRef(options, nameof(options)).Columns, 233Contracts.CheckValue(env, nameof(env));
Transforms\MetadataDispatcher.cs (42)
60Contracts.CheckParam(!getters.Any(g => g == null), nameof(getters), "Invalid getter info"); 77Contracts.CheckNonWhiteSpace(kind, nameof(kind), "Invalid metadata kind"); 78Contracts.CheckValue(type, nameof(type)); 107Contracts.Check(type.RawType == typeof(TValue), "Incompatible types"); 108Contracts.CheckValue(getter, nameof(getter)); 129Contracts.Check(type.RawType == typeof(TValue), "Incompatible types"); 148Contracts.CheckParam(colCount >= 0, nameof(colCount)); 161Contracts.Check(!_sealed, "MetadataDispatcher sealed"); 162Contracts.Check(schemaSrc == null || (0 <= indexSrc && indexSrc < schemaSrc.Count), "indexSrc out of range"); 163Contracts.Check(filterSrc == null || schemaSrc != null, "filterSrc should be null if schemaSrc is null"); 174Contracts.Check(!_sealed, "MetadataDispatcher sealed"); 175Contracts.CheckValue(info, nameof(info)); 176Contracts.CheckParam(0 <= index && index < _infos.Length, nameof(index), "Out of range"); 177Contracts.CheckParam(_infos[index] == null, nameof(index), "Column already registered"); 196Contracts.CheckParam(0 <= index && index < _infos.Length, nameof(index)); 206Contracts.Check(_sealed, "MetadataDispatcher not sealed"); 216Contracts.Assert(_sealed); 217Contracts.AssertValue(info); 252Contracts.Check(_sealed, "MetadataDispatcher not sealed"); 330Contracts.CheckValue(schemaSrc, nameof(schemaSrc)); 341Contracts.CheckValue(schemaSrc, nameof(schemaSrc)); 351Contracts.CheckValue(schemaSrc, nameof(schemaSrc)); 352Contracts.CheckNonWhiteSpace(kindSrc, nameof(kindSrc)); 362Contracts.CheckValue(schemaSrc, nameof(schemaSrc)); 363Contracts.CheckParam(Utils.Size(kindsSrc) >= 2, nameof(kindsSrc)); 364Contracts.CheckParam(!kindsSrc.Any(k => string.IsNullOrWhiteSpace(k)), nameof(kindsSrc)); 392Contracts.CheckValue(md, nameof(md)); 393Contracts.CheckParam(0 <= index && index < md.ColCount, nameof(index)); 400Contracts.Check(tmp == null, "Duplicate building of metadata"); 409Contracts.Check(_md != null, "Builder disposed"); 410Contracts.CheckNonEmpty(kind, nameof(kind)); 411Contracts.CheckValue(type, nameof(type)); 412Contracts.CheckValue(getter, nameof(getter)); 413Contracts.CheckParam(type.RawType == typeof(TValue), nameof(type), "Given type doesn't match type parameter"); 416throw Contracts.Except("Duplicate specification of metadata"); 425Contracts.Check(_md != null, "Builder disposed"); 426Contracts.CheckNonEmpty(kind, nameof(kind)); 427Contracts.CheckValue(type, nameof(type)); 428Contracts.CheckParam(type.RawType == typeof(TValue), nameof(type), "Given type doesn't match type parameter"); 429Contracts.CheckParam(type is PrimitiveDataViewType, nameof(type), "Must be a primitive type"); 432throw Contracts.Except("Duplicate specification of metadata"); 444Contracts.Assert(_info != null);
Transforms\NAFilter.cs (17)
161Contracts.CheckValue(env, nameof(env)); 188Contracts.AssertValue(type); 263Contracts.AssertValue(cursor); 273Contracts.AssertValue(cursor); 274Contracts.AssertValue(info); 294Contracts.AssertValue(cursor); 295Contracts.AssertValue(info); 296Contracts.Assert(!(info.Type is VectorDataViewType)); 297Contracts.Assert(info.Type.RawType == typeof(T)); 306Contracts.AssertValue(cursor); 307Contracts.AssertValue(info); 308Contracts.Assert(info.Type is VectorDataViewType); 309Contracts.Assert(info.Type.RawType == typeof(VBuffer<T>)); 325Contracts.AssertValue(getSrc); 326Contracts.AssertValue(hasBad); 350Contracts.Check(Cursor.IsGood); 372Contracts.Check(Cursor.IsGood);
Transforms\NopTransform.cs (7)
46Contracts.CheckValue(env, nameof(env)); 72Contracts.CheckValue(env, nameof(env)); 82Contracts.AssertValue(host, "host"); 134Contracts.CheckValue(input, nameof(input)); 135Contracts.CheckValue(activeColumns, nameof(activeColumns)); 136Contracts.CheckParam(input.Schema == Source.Schema, nameof(input), "Schema of input row must be the same as the schema the mapper is bound to"); 147Contracts.CheckValue(env, nameof(env));
Transforms\NormalizeColumn.cs (39)
65Contracts.AssertValue(sb); 81Contracts.AssertValue(sb); 92Contracts.AssertNonEmpty(str); 102Contracts.AssertValue(sb); 115Contracts.AssertNonEmpty(str); 125Contracts.AssertValue(sb); 136Contracts.AssertNonEmpty(str); 146Contracts.AssertValue(sb); 298Contracts.CheckValue(env, nameof(env)); 309Contracts.CheckValue(env, nameof(env)); 327Contracts.CheckValue(env, nameof(env)); 347Contracts.CheckValue(env, nameof(env)); 367Contracts.CheckValue(env, nameof(env)); 388Contracts.CheckValue(env, nameof(env)); 412Contracts.CheckValue(host, nameof(host)); 432Contracts.CheckValue(host, nameof(host)); 530Contracts.CheckValue(host, nameof(host)); 551Contracts.CheckValue(host, nameof(host)); 661Contracts.CheckValue(host, nameof(host)); 687Contracts.CheckValue(host, nameof(host)); 728Contracts.CheckValue(host, nameof(host)); 764Contracts.CheckValue(host, nameof(host)); 801Contracts.CheckValue(host, nameof(host)); 969Contracts.AssertValue(host); 1006Contracts.AssertValue(host); 1020Contracts.AssertValue(host); 1046Contracts.AssertValue(host); 1059Contracts.AssertValue(host); 1086Contracts.AssertValue(host); 1100Contracts.AssertValue(host); 1126Contracts.AssertValue(host); 1160Contracts.AssertValue(host); 1184Contracts.AssertValue(host); 1198Contracts.AssertValue(host); 1272Contracts.Assert(m2 >= 0); 1273Contracts.Assert(count >= 0); 1274Contracts.Assert(numZeros >= 0); 1282Contracts.Assert(d2 >= 0); 1284Contracts.Assert(m2 >= 0);
Transforms\NormalizeColumnDbl.cs (102)
30Contracts.AssertValue(ctx); 32Contracts.Check(numFeatures > 0); 33Contracts.CheckValueOrNull(indices); 34Contracts.CheckValue(scales, nameof(scales)); 35Contracts.CheckValueOrNull(offsets); 51Contracts.Assert(offsets == null || offsets.Length == scales.Length); 54Contracts.Assert(scales.Length == numFeatures); 59Contracts.Assert(indices.Length < numFeatures); 60Contracts.Assert(scales.Length == indices.Length); 92Contracts.CheckValue(ctx, nameof(ctx)); 106Contracts.CheckDecode(cbFloat == sizeof(TFloat)); 109Contracts.CheckDecode(size > 0); 114Contracts.CheckDecode(-1 <= morphCount && morphCount < size); 123Contracts.CheckDecode(scaleCount == size); 126Contracts.CheckDecode(offsetCount == 0 || offsetCount == size); 134Contracts.CheckDecode(!TFloat.IsNaN(scale)); 143Contracts.CheckDecode(!TFloat.IsNaN(offset)); 154Contracts.CheckDecode(scaleCount == morphCount); 157Contracts.CheckDecode(offsetCount == 0 || offsetCount == morphCount); 167Contracts.CheckDecode(ivPrev < iv && iv < numFeatures); 170Contracts.CheckDecode(!TFloat.IsNaN(scale)); 179Contracts.CheckDecode(!TFloat.IsNaN(offset)); 185Contracts.Assert(numFeatures > 0); 186Contracts.Assert(scalesSparse != null); 187Contracts.Assert(indicesMorph == null || indicesMorph.Length == scalesSparse.Length); 188Contracts.Assert(offsetsSparse == null || offsetsSparse.Length == scalesSparse.Length); 189Contracts.Assert((offsets == null) == (offsetsSparse == null)); 197Contracts.AssertValue(ctx); 236Contracts.CheckValue(ctx, nameof(ctx)); 246Contracts.CheckDecode(cbFloat == sizeof(TFloat)); 250Contracts.CheckDecode(numFeatures > 0); 255Contracts.CheckDecode(Utils.Size(curUpperBounds) > 0); 258Contracts.CheckDecode(curUpperBounds[j - 1] < curUpperBounds[j]); 259Contracts.CheckDecode(curUpperBounds[curUpperBounds.Length - 1] == TFloat.PositiveInfinity); 300Contracts.CheckDecode(cbFloat == sizeof(TFloat)); 305Contracts.CheckDecode(size > 0); 307throw Contracts.Except("Normalizer expected {0} slots, but the input data column has {1} slots.", size, cv); 327Contracts.Check(size > 0); 356Contracts.Check(value.Length == size); 359Contracts.Assert(0 <= values.Length && values.Length <= size); 470Contracts.Assert(0 <= values.Length && values.Length <= size); 500Contracts.Assert(_trainCount >= _cnan[i] + _cnz[i]); 523Contracts.Assert(dm2 >= 0); 525Contracts.Assert(_m2[j] >= 0); 619Contracts.Check(contatinerStartingSize > 0); 793Contracts.Check(dst.Length == Scale.Length); 803Contracts.Check(dst.Length == Scale.Length); 813Contracts.Check(dst.Length == Scale.Length); 825Contracts.Assert(input.Length == scale.Length); 828Contracts.Assert(0 <= values.Length && values.Length <= size); 847Contracts.Assert(0 <= i && i < size); 855Contracts.Assert(input.Length == scale.Length); 858Contracts.Assert(0 <= values.Length && values.Length <= size); 881Contracts.Assert(ivSrc < size); 884Contracts.Assert(ivDst <= ivSrc && ivSrc <= size); 889Contracts.Assert(ii == values.Length || ivSrc < size); 899Contracts.Assert(input.Length == scale.Length); 903Contracts.Assert(0 <= values.Length && values.Length <= size); 930Contracts.Assert(0 <= ivDst && ivDst <= size); 931Contracts.Assert(0 <= ivSrc && ivSrc <= size); 932Contracts.Assert(ii < values.Length && ivSrc == indices[ii] || ii == values.Length && ivSrc == size); 933Contracts.Assert(inz < nz.Length && ivDst == nz[inz] || inz == nz.Length && ivDst == size); 947Contracts.Assert((ii == values.Length) == (ivSrc >= size)); 951Contracts.Assert(ivSrc == ivDst); 957Contracts.Assert((ii == values.Length) == (ivSrc >= size)); 959Contracts.Assert((inz == nz.Length) == (ivDst >= size)); 962Contracts.Assert(ii == values.Length); 963Contracts.Assert(inz == nz.Length); 1018Contracts.AssertValue(ctx); 1073Contracts.AssertValue(ctx); 1099Contracts.Assert(input.Length == mean.Length); 1102Contracts.Assert(0 <= values.Length && values.Length <= size); 1197Contracts.AssertValue(ctx); 1283Contracts.AssertValue(ctx); 1310Contracts.Assert(input.Length == _binUpperBounds.Length); 1313Contracts.Assert(0 <= values.Length && values.Length <= size); 1345Contracts.Assert(ivSrc < size); 1349Contracts.Assert(ivDst <= ivSrc && ivSrc <= size); 1355Contracts.Assert(ii == values.Length || ivSrc < size); 1368Contracts.Assert(0 <= i && i < size); 1396Contracts.Assert(!TFloat.IsNaN(min)); 1397Contracts.Assert(!TFloat.IsNaN(max)); 1401Contracts.Assert(min <= max || (TFloat.IsPositiveInfinity(min) && TFloat.IsNegativeInfinity(max))); 1416Contracts.Assert(0 <= scale && scale < TFloat.PositiveInfinity); 1421Contracts.Assert(!TFloat.IsNaN(min)); 1422Contracts.Assert(!TFloat.IsNaN(max)); 1426Contracts.Assert(min <= max || (TFloat.IsPositiveInfinity(min) && TFloat.IsNegativeInfinity(max))); 1437Contracts.Assert(0 <= scale && scale < TFloat.PositiveInfinity); 1445Contracts.Assert(!Double.IsNaN(mean)); 1446Contracts.Assert(stddev >= 0); 1457Contracts.Assert(0 <= scale && scale < TFloat.PositiveInfinity); 1462Contracts.Assert(!Double.IsNaN(mean)); 1463Contracts.Assert(meanSquaredError >= 0); 1473Contracts.Assert(0 <= scale && scale < TFloat.PositiveInfinity); 1500Contracts.Check(binIdx < binUpperBounds.Length); 1502Contracts.Assert(-1 <= value && value <= 1); 1511Contracts.Check(binIdx < binUpperBounds.Length); 1513Contracts.Assert(0 <= value & value <= 1); 1699Contracts.Assert(_aggregator.M2[0] >= 0); 1717Contracts.Assert(_aggregator.M2[0] >= 0); 1792Contracts.Assert(_aggregator.M2[i] >= 0); 1838Contracts.Assert(_aggregator.M2[i] >= 0);
Transforms\NormalizeColumnSng.cs (104)
30Contracts.AssertValue(ctx); 32Contracts.Check(numFeatures > 0); 33Contracts.CheckValueOrNull(indices); 34Contracts.CheckValue(scales, nameof(scales)); 35Contracts.CheckValueOrNull(offsets); 51Contracts.Assert(offsets == null || offsets.Length == scales.Length); 54Contracts.Assert(scales.Length == numFeatures); 59Contracts.Assert(indices.Length < numFeatures); 60Contracts.Assert(scales.Length == indices.Length); 92Contracts.CheckValue(ctx, nameof(ctx)); 106Contracts.CheckDecode(cbFloat == sizeof(TFloat)); 109Contracts.CheckDecode(size > 0); 114Contracts.CheckDecode(-1 <= morphCount && morphCount < size); 123Contracts.CheckDecode(scaleCount == size); 126Contracts.CheckDecode(offsetCount == 0 || offsetCount == size); 134Contracts.CheckDecode(!TFloat.IsNaN(scale)); 143Contracts.CheckDecode(!TFloat.IsNaN(offset)); 154Contracts.CheckDecode(scaleCount == morphCount); 157Contracts.CheckDecode(offsetCount == 0 || offsetCount == morphCount); 167Contracts.CheckDecode(ivPrev < iv && iv < numFeatures); 170Contracts.CheckDecode(!TFloat.IsNaN(scale)); 179Contracts.CheckDecode(!TFloat.IsNaN(offset)); 185Contracts.Assert(numFeatures > 0); 186Contracts.Assert(scalesSparse != null); 187Contracts.Assert(indicesMorph == null || indicesMorph.Length == scalesSparse.Length); 188Contracts.Assert(offsetsSparse == null || offsetsSparse.Length == scalesSparse.Length); 189Contracts.Assert((offsets == null) == (offsetsSparse == null)); 197Contracts.AssertValue(ctx); 236Contracts.CheckValue(ctx, nameof(ctx)); 246Contracts.CheckDecode(cbFloat == sizeof(TFloat)); 250Contracts.CheckDecode(numFeatures > 0); 255Contracts.CheckDecode(Utils.Size(curUpperBounds) > 0); 258Contracts.CheckDecode(curUpperBounds[j - 1] < curUpperBounds[j]); 259Contracts.CheckDecode(curUpperBounds[curUpperBounds.Length - 1] == TFloat.PositiveInfinity); 300Contracts.CheckDecode(cbFloat == sizeof(TFloat)); 305Contracts.CheckDecode(size > 0); 307throw Contracts.Except("Normalizer expected {0} slots, but the input data column has {1} slots.", size, cv); 327Contracts.Check(size > 0); 356Contracts.Check(value.Length == size); 360Contracts.Assert(0 <= count && count <= size); 472Contracts.Assert(0 <= count && count <= size); 502Contracts.Assert(_trainCount >= _cnan[i] + _cnz[i]); 525Contracts.Assert(dm2 >= 0); 527Contracts.Assert(_m2[j] >= 0); 570Contracts.Check(Elements.Count > 0, "Cannot peek with 0 elements"); 577Contracts.Check(Elements.Count > 0, "Cannot pop with 0 elements"); 777Contracts.Check(contatinerStartingSize > 0); 950Contracts.Check(dst.Length == Scale.Length); 960Contracts.Check(dst.Length == Scale.Length); 970Contracts.Check(dst.Length == Scale.Length); 982Contracts.Assert(input.Length == scale.Length); 986Contracts.Assert(0 <= count && count <= size); 1005Contracts.Assert(0 <= i && i < size); 1013Contracts.Assert(input.Length == scale.Length); 1017Contracts.Assert(0 <= count && count <= size); 1040Contracts.Assert(ivSrc < size); 1043Contracts.Assert(ivDst <= ivSrc && ivSrc <= size); 1048Contracts.Assert(ii == count || ivSrc < size); 1058Contracts.Assert(input.Length == scale.Length); 1063Contracts.Assert(0 <= count && count <= size); 1090Contracts.Assert(0 <= ivDst && ivDst <= size); 1091Contracts.Assert(0 <= ivSrc && ivSrc <= size); 1092Contracts.Assert(ii < count && ivSrc == indices[ii] || ii == count && ivSrc == size); 1093Contracts.Assert(inz < nz.Length && ivDst == nz[inz] || inz == nz.Length && ivDst == size); 1107Contracts.Assert((ii == count) == (ivSrc >= size)); 1111Contracts.Assert(ivSrc == ivDst); 1117Contracts.Assert((ii == count) == (ivSrc >= size)); 1119Contracts.Assert((inz == nz.Length) == (ivDst >= size)); 1122Contracts.Assert(ii == count); 1123Contracts.Assert(inz == nz.Length); 1178Contracts.AssertValue(ctx); 1233Contracts.AssertValue(ctx); 1259Contracts.Assert(input.Length == mean.Length); 1263Contracts.Assert(0 <= count && count <= size); 1358Contracts.AssertValue(ctx); 1444Contracts.AssertValue(ctx); 1471Contracts.Assert(input.Length == _binUpperBounds.Length); 1475Contracts.Assert(0 <= count && count <= size); 1507Contracts.Assert(ivSrc < size); 1511Contracts.Assert(ivDst <= ivSrc && ivSrc <= size); 1517Contracts.Assert(ii == count || ivSrc < size); 1530Contracts.Assert(0 <= i && i < size); 1559Contracts.Assert(!TFloat.IsNaN(min)); 1560Contracts.Assert(!TFloat.IsNaN(max)); 1564Contracts.Assert(min <= max || (TFloat.IsPositiveInfinity(min) && TFloat.IsNegativeInfinity(max))); 1579Contracts.Assert(0 <= scale && scale < TFloat.PositiveInfinity); 1584Contracts.Assert(!TFloat.IsNaN(min)); 1585Contracts.Assert(!TFloat.IsNaN(max)); 1589Contracts.Assert(min <= max || (TFloat.IsPositiveInfinity(min) && TFloat.IsNegativeInfinity(max))); 1600Contracts.Assert(0 <= scale && scale < TFloat.PositiveInfinity); 1608Contracts.Assert(!Double.IsNaN(mean)); 1609Contracts.Assert(stddev >= 0); 1620Contracts.Assert(0 <= scale && scale < TFloat.PositiveInfinity); 1625Contracts.Assert(!Double.IsNaN(mean)); 1626Contracts.Assert(meanSquaredError >= 0); 1636Contracts.Assert(0 <= scale && scale < TFloat.PositiveInfinity); 1663Contracts.Check(binIdx < binUpperBounds.Length); 1665Contracts.Assert(-1 <= value && value <= 1); 1674Contracts.Check(binIdx < binUpperBounds.Length); 1676Contracts.Assert(0 <= value & value <= 1); 1862Contracts.Assert(_aggregator.M2[0] >= 0); 1880Contracts.Assert(_aggregator.M2[0] >= 0); 1955Contracts.Assert(_aggregator.M2[i] >= 0); 2001Contracts.Assert(_aggregator.M2[i] >= 0);
Transforms\Normalizer.cs (27)
135Contracts.CheckNonEmpty(name, nameof(name)); 136Contracts.CheckNonEmpty(inputColumnName, nameof(inputColumnName)); 137Contracts.CheckParam(maximumExampleCount > 1, nameof(maximumExampleCount), "Must be greater than 1"); 163throw Contracts.ExceptParam(nameof(mode), "Unknown normalizer mode"); 311Contracts.CheckValue(env, nameof(env)); 324Contracts.CheckValue(env, nameof(env)); 427Contracts.AssertValue(ctx); 437Contracts.CheckDecode(vectorSize >= 0); 438Contracts.CheckDecode(vectorSize > 0 || !isVectorOld); 440Contracts.CheckDecode(itemKindOld == InternalDataKind.R4 || itemKindOld == InternalDataKind.R8); 454Contracts.CheckDecode(itemKind == InternalDataKind.R4 || itemKind == InternalDataKind.R8); 464Contracts.AssertValue(ctx); 477Contracts.Assert(itemKind == InternalDataKind.R4 || itemKind == InternalDataKind.R8); 480Contracts.Assert(vectorType == null || vectorType.IsKnownSize); 519Contracts.CheckUserArg(index >= 0 && index < Columns.Length, nameof(index), errMsg); 533Contracts.CheckValue(env, nameof(env)); 657Contracts.CheckValue(env, nameof(env)); 666Contracts.CheckValue(env, nameof(env)); 815Contracts.AssertValue(ctx); 816Contracts.Assert(0 <= iinfo && iinfo < _parent.Columns.Length); 817Contracts.Assert(_parent.Columns[iinfo] == info); 818Contracts.AssertValue(srcToken); 819Contracts.Assert(CanSavePfa); 825Contracts.AssertValue(ctx); 826Contracts.Assert(0 <= iinfo && iinfo < _parent.Columns.Length); 827Contracts.Assert(_parent.Columns[iinfo] == info); 828Contracts.Assert(CanSaveOnnx(ctx));
Transforms\NormalizeUtils.cs (5)
82Contracts.CheckValue(env, nameof(env)); 94Contracts.CheckValue(env, nameof(env)); 106Contracts.CheckValue(env, nameof(env)); 118Contracts.CheckValue(env, nameof(env)); 130Contracts.CheckValue(env, nameof(env));
Transforms\OneToOneTransformerBase.cs (4)
30throw Contracts.ExceptParam(nameof(columns), $"Name of the result column '{column.outputColumnName}' specified multiple times"); 76Contracts.AssertValue(inputSchema); 77Contracts.Assert(0 <= col && col < ColumnPairs.Length); 98Contracts.AssertValue(parent);
Transforms\PerGroupTransformBase.cs (7)
57Contracts.ExceptDecode("Group column '{0}' does not exist", groupCol); 64Contracts.AssertValue(predicate); 104Contracts.CheckValue(env, nameof(env)); 119Contracts.CheckValue(env, nameof(env)); 187Contracts.Assert(active.Length == bindings.ColumnCount); 293Contracts.CheckParam(IsColumnActive(column), nameof(column), "requested column is not active"); 299Contracts.AssertValue(_input);
Transforms\RangeFilter.cs (3)
169Contracts.CheckValue(env, nameof(env)); 335Contracts.Assert(filter._type is KeyDataViewType); 343Contracts.Assert(filter._type is KeyDataViewType);
Transforms\RowShufflingTransformer.cs (11)
154Contracts.CheckValue(env, nameof(env)); 227Contracts.CheckValue(provider, nameof(provider)); 374Contracts.Assert(bufferSize > 0); 375Contracts.AssertValue(type); 376Contracts.AssertValue(getter); 383Contracts.Assert(type is PrimitiveDataViewType); 432Contracts.AssertValue(getter); 433Contracts.Assert(getter is ValueGetter<T>); 440Contracts.Assert(0 <= idx && idx < Buffer.Length); 450Contracts.Assert(0 <= idx && idx < Buffer.Length); 558Contracts.Assert(retval);
Transforms\RowToRowTransformerBase.cs (4)
21Contracts.AssertValue(host); 66Contracts.CheckValue(host, nameof(host)); 67Contracts.CheckValue(inputSchema, nameof(inputSchema)); 84Contracts.Assert(input.Schema == InputSchema);
Transforms\SkipTakeFilter.cs (4)
125Contracts.CheckValue(env, nameof(env)); 136Contracts.CheckValue(env, nameof(env)); 144Contracts.CheckValue(env, nameof(env)); 153Contracts.CheckValue(env, nameof(env));
Transforms\SlotsDroppingTransformer.cs (36)
56Contracts.CheckNonWhiteSpace(str, nameof(str)); 66Contracts.AssertNonEmpty(str); 79Contracts.AssertValue(str); 94Contracts.CheckValue(sb, nameof(sb)); 130Contracts.CheckNonWhiteSpace(str, nameof(str)); 140Contracts.AssertNonEmpty(str); 172Contracts.CheckValue(sb, nameof(sb)); 213Contracts.CheckValue(Name, nameof(Name)); 215Contracts.CheckValue(InputColumnName, nameof(InputColumnName)); 220Contracts.Assert(min >= 0 && (max == null || min <= max)); 226Contracts.CheckValue(Name, nameof(Name)); 228Contracts.CheckValue(InputColumnName, nameof(InputColumnName)); 231Contracts.Assert(min >= 0 && (max == null || min <= max)); 275: base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), GetColumnPairs(columns)) 283: base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), ctx) 308Contracts.CheckValue(env, nameof(env)); 574Contracts.Assert(catRanges.Length > 0 && catRanges.Length % 2 == 0); 600Contracts.Assert(rangesIndex % 2 == 0); 601Contracts.Assert(ranges[rangesIndex] <= ranges[rangesIndex + 1]); 614Contracts.Assert(min == -1 && max == -1); 631Contracts.Assert(min >= 0 && min <= max); 638Contracts.Assert(min == -1 && max == -1); 651Contracts.Assert(min == -1 && max == -1); 671Contracts.Assert(dropSlotsIndex - previousDropSlotsIndex == 1); 677Contracts.Assert(rangesIndex % 2 == 0); 681Contracts.Assert(rangesIndex < ranges.Length - 1); 692Contracts.Assert(min == -1 && max == -1); 697Contracts.Assert(newCategoricalSlotRanges.Count % 2 == 0); 698Contracts.Assert(newCategoricalSlotRanges.TrueForAll(x => x >= 0)); 699Contracts.Assert(0 <= droppedSlotsCount && droppedSlotsCount <= slotsMax[slotsMax.Length - 1] + 1); 709Contracts.Assert(minRange2 >= 0 && maxRange2 >= 0); 710Contracts.Assert(minRange2 <= maxRange2); 711Contracts.Assert(minRange1 >= 0 && maxRange1 >= 0); 712Contracts.Assert(minRange1 <= maxRange1); 713Contracts.Assert(maxRange1 + 1 == minRange2); 861Contracts.Assert(dst.Length % 2 == 0);
Transforms\TrainAndScoreTransformer.cs (5)
80Contracts.CheckValue(env, nameof(env)); 184Contracts.CheckValue(env, nameof(env)); 204Contracts.CheckValue(env, nameof(env)); 216Contracts.CheckValue(env, nameof(env)); 228Contracts.AssertValue(env, nameof(env));
Transforms\TransformBase.cs (16)
29Contracts.CheckValue(env, nameof(env)); 39Contracts.CheckValue(host, nameof(host)); 233Contracts.Assert(originFn != null); 236throw Contracts.Except($"Invalid TValue in GetGetter: '{typeof(TValue)}', " + 282Contracts.AssertNonEmpty(name); 283Contracts.Assert(colSrc >= 0); 284Contracts.AssertValue(typeSrc); 285Contracts.AssertValueOrNull(slotTypeSrc); 286Contracts.Assert(slotTypeSrc == null || typeSrc.GetItemType().Equals(slotTypeSrc.ItemType)); 319Contracts.AssertValue(parent); 320Contracts.AssertValue(parent.Host); 321Contracts.Assert(Utils.Size(infos) == InfoCount); 330Contracts.AssertValue(parent); 367Contracts.AssertValue(parent); 414Contracts.AssertValue(ctx); 434Contracts.AssertValue(columns);
Transforms\TransformsCatalog.cs (1)
39Contracts.AssertValue(env);
Transforms\TypeConverting.cs (11)
39Contracts.CheckValue(env, nameof(env)); 80Contracts.AssertNonEmpty(str); 97Contracts.AssertValue(sb); 180Contracts.CheckNonEmpty(columns, nameof(columns)); 201: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(TypeConvertingTransformer)), GetColumnPairs(columns)) 238Contracts.CheckValue(env, nameof(env)); 297Contracts.CheckValue(env, nameof(env)); 469Contracts.AssertValue(input); 470Contracts.Assert(0 <= iinfo && iinfo < _parent.ColumnPairs.Length); 590throw Contracts.ExceptUserArg(nameof(type), $"Unsupported type {type}."); 614base(Contracts.CheckRef(env, nameof(env)).Register(nameof(TypeConvertingEstimator)), new TypeConvertingTransformer(env, columns))
Transforms\ValueMapping.cs (8)
79: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ValueMappingEstimator)), 403Contracts.AssertValue(sb); 433: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ValueMappingTransformer)), columns) 604Contracts.CheckValue(env, nameof(env)); 712Contracts.CheckValue(env, nameof(env)); 747Contracts.AssertValue(ectx); 778throw Contracts.Except($"Unsupported type {type} used in mapping."); 985Contracts.AssertValue(host);
Transforms\ValueToKeyMappingEstimator.cs (3)
97Contracts.CheckNonWhiteSpace(outputColumnName, nameof(outputColumnName)); 154Contracts.CheckValue(env, nameof(env)); 198Contracts.Assert(kv.IsValid);
Transforms\ValueToKeyMappingTransformer.cs (16)
68Contracts.AssertValue(sb); 91Contracts.AssertValue(sb); 214Contracts.CheckValue(columns, nameof(columns)); 252: base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), GetColumnPairs(columns)) 269Contracts.CheckValue(env, nameof(env)); 310Contracts.CheckValue(env, nameof(env)); 469Contracts.AssertValue(ch); 517Contracts.AssertValue(env); 573Contracts.Check(trainingData.Schema.TryGetColumnIndex(infos[iinfo].InputColumnName, out int colIndex)); 695Contracts.Assert(0 <= iinfo && iinfo < _unboundMaps.Length); 758Contracts.AssertValue(input); 759Contracts.Assert(0 <= iinfo && iinfo < _parent.ColumnPairs.Length); 955Contracts.AssertValue(ctx); 956Contracts.Assert(0 <= iinfo && iinfo < _infos.Length); 957Contracts.Assert(_infos[iinfo] == info); 958Contracts.AssertValue(srcToken);
Transforms\ValueToKeyMappingTransformerImpl.cs (48)
38Contracts.AssertValue(type); 44Contracts.AssertValue(type); 45Contracts.Assert(type is VectorDataViewType || type is PrimitiveDataViewType); 50Contracts.Assert(sortOrder == ValueToKeyMappingEstimator.KeyOrdinality.ByOccurrence || sortOrder == ValueToKeyMappingEstimator.KeyOrdinality.ByValue); 54Contracts.AssertValue(itemType); 63Contracts.AssertValue(type); 64Contracts.Assert(type.RawType == typeof(T)); 132Contracts.Assert(nstr.Id == i); 133Contracts.Assert(i == 0 || sortedPool.GetNormStrById(i - 1).Value.Span.CompareTo(sortedPool.GetNormStrById(i).Value.Span, StringComparison.Ordinal) < 0); 135Contracts.Assert(sortedPool.Count == _pool.Count); 167Contracts.Assert(type.RawType == typeof(T)); 168Contracts.AssertValue(mapsToMissing); 267Contracts.AssertValue(bldr); 268Contracts.Assert(max >= 0); 286Contracts.AssertValue(row); 288Contracts.Assert(0 <= col && col < schema.Count); 289Contracts.Assert(count > 0); 290Contracts.AssertValue(bldr); 293Contracts.Assert(autoConvert || bldr.ItemType == type.GetItemType()); 295Contracts.Assert(type is TextDataViewType || !autoConvert); 303Contracts.AssertValue(row); 304Contracts.AssertValue(bldr); 305Contracts.Assert(bldr is Builder<T>); 319Contracts.AssertValue(row); 320Contracts.AssertValue(bldr); 321Contracts.Assert(bldr is Builder<T>); 354Contracts.AssertValue(getter); 355Contracts.AssertValue(bldr); 362Contracts.Assert(_remaining >= 0); 380Contracts.AssertValue(getter); 381Contracts.AssertValue(bldr); 388Contracts.Assert(_remaining > 0); 394Contracts.Assert(_remaining >= 0); 416Contracts.Assert(!_val.IsDense && !_addedDefaultFromSparse); 503Contracts.AssertValue(type); 504Contracts.Assert(count >= 0); 546Contracts.AssertValue(ectx); 589Contracts.AssertValue(pool); 660Contracts.Assert(0 <= nstr.Id && nstr.Id < editor.Values.Length); 661Contracts.Assert(nstr.Id == slot); 688Contracts.AssertValue(values); 741Contracts.AssertValue(_values); 742Contracts.Assert(_values.Count == Count); 767Contracts.Assert(ItemType.RawType == typeof(T)); 783Contracts.Assert(typeof(T) != typeof(ReadOnlyMemory<char>)); 789Contracts.Assert(src.IsDense); 910Contracts.Assert(!(info.TypeSrc is VectorDataViewType)); 1154Contracts.Assert(tempMeta.IsDense);
Utilities\ApplyTransformUtils.cs (2)
28Contracts.CheckValue(env, nameof(env)); 70Contracts.CheckValue(env, nameof(env));
Utilities\ColumnCursor.cs (13)
36Contracts.CheckValue(data, nameof(data)); 37Contracts.CheckNonEmpty(column.Name, nameof(column)); 46throw Contracts.ExceptParam(nameof(column), string.Format("column with name {0}, type {1}, and index {2} cannot be found in {3}", 74throw Contracts.ExceptParam(nameof(column), string.Format("Cannot load vector type, {0}, specified in {1} to the user-defined type, {2}.", column.Type, nameof(column), typeof(T))); 94throw Contracts.ExceptParam(nameof(column), string.Format("Cannot map column (name: {0}, type: {1}) in {2} to the user-defined type, {3}.", 100Contracts.AssertValue(data); 101Contracts.Assert(0 <= col && col < data.Schema.Count); 118Contracts.AssertValue(data); 119Contracts.Assert(0 <= col && col < data.Schema.Count); 136Contracts.AssertValue(data); 137Contracts.Assert(0 <= col && col < data.Schema.Count); 158Contracts.AssertValue(data); 159Contracts.Assert(0 <= col && col < data.Schema.Count);
Utilities\ComponentCreation.cs (17)
31Contracts.CheckValue(env, nameof(env)); 50Contracts.CheckValue(env, nameof(env)); 71Contracts.CheckValue(env, nameof(env)); 86Contracts.CheckValue(env, nameof(env)); 97Contracts.CheckValue(env, nameof(env)); 98Contracts.CheckValue(files, nameof(files)); 109Contracts.CheckValue(env, nameof(env)); 118Contracts.CheckValue(env, nameof(env)); 128Contracts.CheckValue(env, nameof(env)); 138Contracts.CheckValue(env, nameof(env)); 158Contracts.CheckValue(env, nameof(env)); 189Contracts.CheckValue(env, nameof(env)); 199Contracts.CheckValue(env, nameof(env)); 211Contracts.CheckValue(modelStream, nameof(modelStream)); 218Contracts.CheckValue(env, nameof(env)); 224Contracts.CheckValue(env, nameof(env)); 278Contracts.AssertValue(env);
Utilities\LocalEnvironment.cs (16)
68Contracts.AssertValue(rand); 69Contracts.AssertValueOrNull(parentFullName); 70Contracts.AssertNonEmpty(shortName); 71Contracts.Assert(source == this || source is Host); 77Contracts.AssertValue(parent); 78Contracts.Assert(parent is LocalEnvironment); 79Contracts.AssertNonEmpty(name); 85Contracts.AssertValue(parent); 86Contracts.Assert(parent is LocalEnvironment); 87Contracts.AssertNonEmpty(name); 101Contracts.AssertValue(parent); 102Contracts.Assert(parent is Host); 103Contracts.AssertNonEmpty(name); 109Contracts.AssertValue(parent); 110Contracts.Assert(parent is Host); 111Contracts.AssertNonEmpty(name);
Utilities\ModelFileUtils.cs (26)
46Contracts.CheckValue(env, nameof(env)); 66Contracts.CheckValue(env, nameof(env)); 107Contracts.CheckValue(env, nameof(env)); 128Contracts.CheckValue(env, nameof(env)); 145Contracts.CheckValue(env, nameof(env)); 146Contracts.CheckValue(modelStream, nameof(modelStream)); 156Contracts.CheckValue(env, nameof(env)); 157Contracts.CheckValue(rep, nameof(rep)); 168Contracts.CheckValue(rep, nameof(rep)); 178Contracts.CheckValue(env, nameof(env)); 210Contracts.CheckValue(rep, nameof(rep)); 235Contracts.AssertValue(env); 271Contracts.CheckValue(env, nameof(env)); 284Contracts.CheckValue(env, nameof(env)); 330Contracts.CheckValue(env, nameof(env)); 344Contracts.CheckValue(env, nameof(env)); 366Contracts.CheckValue(repository, nameof(repository)); 367Contracts.CheckNonWhiteSpace(directory, nameof(directory)); 368Contracts.CheckNonWhiteSpace(filename, nameof(filename)); 379Contracts.Check(index == 0); 385Contracts.Assert(index == 0); 388throw Contracts.Except($"File '{_filename}' is missing from the repository"); 457Contracts.CheckValue(entry, nameof(entry)); 458Contracts.CheckValue(entry.Stream, nameof(entry.Stream)); 507Contracts.AssertValue(_entry); 508Contracts.AssertValue(_entry.Stream);
Utilities\SlotDropper.cs (17)
40Contracts.CheckValue(slotsMin, nameof(slotsMin)); 41Contracts.CheckValue(slotsMax, nameof(slotsMax)); 42Contracts.CheckNonEmpty(slotsMin, nameof(slotsMin)); 43Contracts.CheckNonEmpty(slotsMax, nameof(slotsMax)); 44Contracts.CheckParam(slotsMin.Length == slotsMax.Length, 52Contracts.Check(SlotsMin.Length == _lengthReduction.Length); 64Contracts.Assert(dstLength >= 0); 75Contracts.Assert(SlotsMin[i] > prevLim); 76Contracts.Assert(SlotsMin[i] <= SlotsMax[i]); 119Contracts.Assert(newLength < src.Length); 136Contracts.Assert(iDst <= iSrc); 143Contracts.Assert(iDst <= iSrc); 146Contracts.Assert(iDst == newLength); 157Contracts.Assert(newCount <= src.Length); 179Contracts.Assert(iiDst <= iiSrc); 200Contracts.Assert(iRange == SlotsMax.Length || 214Contracts.Assert(index <= max);
Utilities\TimerScope.cs (1)
25Contracts.AssertValue(ch);
Utilities\TypeParsingUtils.cs (10)
29Contracts.CheckValue(str, nameof(str)); 57Contracts.CheckValue(keyCount, nameof(keyCount)); 61Contracts.CheckUserArg(KeyDataViewType.IsValidDataType(rawType), nameof(TextLoader.Column.Type), "Bad item type for Key"); 90throw Contracts.ExceptParam(nameof(count), "The cardinality of valid values of a " 103Contracts.AssertValue(str); 113Contracts.AssertValue(str); 128throw Contracts.ExceptDecode("The minimum logical value of a " + nameof(KeyDataViewType) + " is required to be zero."); 145Contracts.CheckDecode(Count == null || Count > 0); 151Contracts.AssertValue(sb); 152Contracts.Assert(Count == null || Count > 0);
Utils\ApiUtils.cs (5)
60throw Contracts.ExceptNotSupp("Type '{0}' is not supported.", t.FullName); 83Contracts.Assert(false); 84throw Contracts.ExceptNotSupp("Expected a FieldInfo or a PropertyInfo"); 151Contracts.Assert(false); 152throw Contracts.ExceptNotSupp("Expected a FieldInfo or a PropertyInfo");
Utils\LossFunctions.cs (3)
337Contracts.CheckParam(smoothingConstant >= 0, nameof(smoothingConstant), "Must be non-negative."); 598Contracts.CheckUserArg(1 <= options.Index && options.Index <= 2, nameof(options.Index), "Must be in the range [1, 2]"); 611Contracts.CheckParam(1 <= index && index <= 2, nameof(index), "Must be in the range [1, 2]");
Utils\SequencePool.cs (37)
71Contracts.CheckDecode(0 <= _idLim && _idLim < int.MaxValue); 73Contracts.CheckDecode(Utils.Size(_start) > 0 && _start[0] == 0); 74Contracts.CheckDecode(_start[_idLim] >= 0); 83Contracts.Assert(4 <= ibit && ibit <= 31); 97Contracts.CheckDecode(_start[id] <= _start[id + 1] && _start[id + 1] <= cb); 120Contracts.Assert(_start[id] <= _start[id + 1]); 130Contracts.AssertValue(_buckets); 131Contracts.Assert(_buckets.Length == _mask + 1); 132Contracts.Assert(Utils.IsPowerOfTwo(_mask + 1)); 134Contracts.Assert(0 <= _idLim && Math.Max(10, _idLim) <= Utils.Size(_start) - 1); 135Contracts.Assert(Math.Max(10, _idLim) <= Utils.Size(_hash)); 136Contracts.Assert(Math.Max(10, _idLim) <= Utils.Size(_next)); 137Contracts.Assert(_start[0] == 0); 138Contracts.Assert(0 <= _start[_idLim] && Math.Max(40, _start[_idLim]) <= Utils.Size(_bytes)); 155Contracts.Assert(0 <= min && min <= lim && lim <= Utils.Size(sequence)); 161Contracts.Assert(0 <= idCur && idCur < _idLim); 169Contracts.Assert(ibCur <= ibLim); 182Contracts.Assert(success); 200Contracts.Check(0 <= min && min <= lim && lim <= Utils.Size(sequence)); 208Contracts.Assert(id == _idLim - 1); 221Contracts.Check(0 <= min && min <= lim && lim <= Utils.Size(sequence)); 232Contracts.Assert(0 <= min && min <= lim && lim <= Utils.Size(sequence)); 233Contracts.Assert(Hashing.HashSequence(sequence, min, lim) == hash); 237Contracts.Check(_start.Length != Utils.ArrayMaxSize, "Cannot allocate memory for the sequence pool"); 238Contracts.Assert(_idLim + 1 == _start.Length); 244Contracts.Assert(_hash.Length >= _next.Length); 247Contracts.Check(_next.Length != Utils.ArrayMaxSize, "Cannot allocate memory for the sequence pool"); 248Contracts.Assert(_idLim == _next.Length); 259Contracts.Check(_bytes.Length != Utils.ArrayMaxSize, "Cannot allocate memory for the sequence pool"); 264Contracts.Assert(_idLim < _next.Length); 265Contracts.Assert(ibLim <= _bytes.Length - cbMax); 302Contracts.Check(0 <= id && id < _idLim); 309Contracts.Assert(bytes.Length >= ib + 5 * (lim - min)); 347Contracts.Assert(0 <= min && min <= lim && lim <= Utils.Size(bytes)); 355Contracts.Assert(count < lim - min); 358Contracts.CheckDecode(TryDecodeOne(bytes, ref cur, lim, out sequence[count])); 359Contracts.Assert(cur <= lim);
Microsoft.ML.Ensemble (81)
Batch.cs (2)
17Contracts.CheckValue(trainData, nameof(trainData)); 18Contracts.CheckValue(testData, nameof(testData));
EnsembleUtils.cs (10)
20Contracts.AssertValue(host); 21Contracts.AssertValue(data); 22Contracts.Assert(data.Schema.Feature.HasValue); 23Contracts.AssertValue(features); 28Contracts.Assert(features.Length == typeVectorSize); 49Contracts.Assert(Utils.Size(includedIndices) == src.Length); 50Contracts.Assert(cardinality == Utils.GetCardinality(includedIndices)); 51Contracts.Assert(cardinality < src.Length); 73Contracts.Assert(count < cardinality); 80Contracts.Assert(count == cardinality);
EntryPoints\CreateEnsemble.cs (9)
92Contracts.AssertValue(env); 134Contracts.CheckValue(env, nameof(env)); 169Contracts.CheckValue(env, nameof(env)); 201Contracts.CheckValue(env, nameof(env)); 228Contracts.CheckValue(env, nameof(env)); 252Contracts.CheckValue(env, nameof(env)); 279Contracts.CheckValue(env, nameof(env)); 326Contracts.CheckValue(env, nameof(env)); 361Contracts.CheckValue(env, nameof(env));
EntryPoints\Ensemble.cs (3)
19Contracts.CheckValue(env, nameof(env)); 32Contracts.CheckValue(env, nameof(env)); 45Contracts.CheckValue(env, nameof(env));
EntryPoints\PipelineEnsemble.cs (1)
29Contracts.CheckValue(env, nameof(env));
FeatureSubsetModel.cs (1)
25throw Contracts.ExceptParam(nameof(predictor),
OutputCombiners\Average.cs (1)
44Contracts.CheckValue(env, nameof(env));
OutputCombiners\BaseAverager.cs (2)
15Contracts.CheckValue(env, nameof(env)); 22Contracts.AssertValue(env);
OutputCombiners\BaseMultiCombiner.cs (3)
29Contracts.AssertValue(env); 39Contracts.AssertValue(env); 100Contracts.Assert(len >= 0);
OutputCombiners\BaseScalarStacking.cs (1)
26Contracts.AssertNonEmpty(src);
OutputCombiners\BaseStacking.cs (9)
36Contracts.AssertValue(env); 51Contracts.AssertValue(env); 91Contracts.Check(Meta != null, "Training of stacking combiner not complete"); 113Contracts.Assert(Meta != null); 116Contracts.Check(ivm != null, "Stacking predictor doesn't implement the expected interface"); 118throw Contracts.Except("Stacking predictor input type is unsupported: {0}", ivm.InputType); 120throw Contracts.Except("Stacking predictor output type is unsupported: {0}", ivm.OutputType); 125Contracts.CheckValue(env, nameof(env)); 138Contracts.Assert(models[i].Predictor is IValueMapper);
OutputCombiners\Median.cs (3)
39Contracts.CheckValue(env, nameof(env)); 45Contracts.AssertValue(env); 56Contracts.CheckValue(env, nameof(env));
OutputCombiners\MultiAverage.cs (1)
53Contracts.CheckValue(env, nameof(env));
OutputCombiners\MultiMedian.cs (1)
56Contracts.CheckValue(env, nameof(env));
OutputCombiners\MultiStacking.cs (4)
68Contracts.CheckValue(env, nameof(env)); 82Contracts.AssertNonEmpty(src); 96Contracts.Assert(iv <= len); 98Contracts.Assert(iv == len);
OutputCombiners\MultiVoting.cs (2)
54Contracts.CheckValue(env, nameof(env)); 62Contracts.Assert(!Normalize);
OutputCombiners\MultiWeightedAverage.cs (1)
74Contracts.CheckValue(env, nameof(env));
OutputCombiners\RegressionStacking.cs (1)
66Contracts.CheckValue(env, nameof(env));
OutputCombiners\Stacking.cs (1)
65Contracts.CheckValue(env, nameof(env));
OutputCombiners\Voting.cs (3)
36Contracts.CheckValue(env, nameof(env)); 42Contracts.AssertValue(env); 54Contracts.CheckValue(env, nameof(env));
OutputCombiners\WeightedAverage.cs (2)
71Contracts.CheckValue(env, nameof(env)); 85Contracts.Assert(Enum.IsDefined(typeof(WeightageKind), _weightageKind));
PipelineEnsemble.cs (4)
405Contracts.CheckValue(env, nameof(env)); 509Contracts.AssertValue(_inputCols); 546Contracts.CheckValue(env, nameof(env)); 591Contracts.CheckValue(env, nameof(env));
Selector\DiversityMeasure\BaseDisagreementDiversityMeasure.cs (2)
17Contracts.Assert(models.Count > 1); 18Contracts.Assert(predictions.Count == models.Count);
Selector\FeatureSelector\RandomFeatureSelector.cs (1)
38Contracts.CheckValue(env, nameof(env));
Selector\SubModelSelector\BaseBestPerformanceSelector.cs (6)
48Contracts.Assert(type.IsEnum); 49Contracts.Assert(value.GetType() == type); 65Contracts.Assert(false); 76Contracts.AssertValue(metricName); 98throw Contracts.Except("Metrics did not contain the requested metric '{0}'", _metricName); 111throw Contracts.Except("Metrics did not contain the requested metric '{0}'", _metricName);
Selector\SubModelSelector\BaseSubModelSelector.cs (1)
23Contracts.CheckValue(env, nameof(env));
Selector\SubsetSelector\BaseSubsetSelector.cs (1)
34Contracts.CheckValue(env, nameof(env));
Subset.cs (1)
18Contracts.AssertValue(data);
Trainer\EnsembleDistributionModelParameters.cs (1)
124Contracts.CheckValue(env, nameof(env));
Trainer\EnsembleModelParameters.cs (1)
114Contracts.CheckValue(env, nameof(env));
Trainer\EnsembleTrainerBase.cs (1)
77Contracts.CheckValue(env, nameof(env));
Trainer\Multiclass\EnsembleMulticlassModelParameters.cs (1)
96Contracts.CheckValue(env, nameof(env));
Microsoft.ML.EntryPoints (58)
CVSplit.cs (1)
49Contracts.CheckValue(env, nameof(env));
DataViewReference.cs (1)
31Contracts.CheckValue(env, nameof(env));
FeatureCombiner.cs (18)
48Contracts.CheckValue(env, nameof(env)); 64Contracts.Assert(featNames.Count > 0); 65Contracts.Assert(concatNames.Count == featNames.Count); 89Contracts.AssertValueOrNull(ktv); 90Contracts.AssertValue(viewTrain); 91Contracts.AssertValue(host); 117Contracts.AssertValue(data); 118Contracts.AssertNonWhiteSpace(colName); 144Contracts.AssertValueOrNull(cvt); 145Contracts.AssertValue(viewTrain); 146Contracts.AssertValue(env); 155Contracts.AssertValue(feats); 156Contracts.AssertValue(featNames); 157Contracts.AssertValue(concatNames); 158Contracts.AssertValue(ch); 230Contracts.CheckValue(env, nameof(env)); 266Contracts.CheckValue(env, nameof(env)); 288Contracts.CheckValue(env, nameof(env));
ImportTextData.cs (2)
38Contracts.CheckValue(env, nameof(env)); 58Contracts.CheckValue(env, nameof(env));
JsonUtils\ExecuteGraphCommand.cs (3)
41Contracts.CheckValue(env, nameof(env)); 213Contracts.CheckValue(pm, nameof(pm)); 226Contracts.CheckValue(idv, nameof(idv));
JsonUtils\GraphRunner.cs (2)
28Contracts.CheckValue(env, nameof(env)); 37Contracts.CheckValue(env, nameof(env));
JsonUtils\JsonManifestUtils.cs (8)
28Contracts.CheckValueOrNull(ectx); 100Contracts.AssertValueOrNull(ectx); 116Contracts.CheckValueOrNull(ectx); 150Contracts.AssertValueOrNull(ectx); 281Contracts.AssertValueOrNull(ectx); 309Contracts.AssertValueOrNull(ectx); 395Contracts.AssertValueOrNull(ectx); 454Contracts.AssertValueOrNull(ectx);
MacroUtils.cs (1)
72throw Contracts.Except("Trainer kind not supported");
ModelOperations.cs (4)
86Contracts.CheckValue(env, nameof(env)); 102Contracts.CheckValue(env, nameof(env)); 117Contracts.CheckValue(env, nameof(env)); 134Contracts.CheckValue(env, nameof(env));
OneVersusAllMacro.cs (2)
53Contracts.AssertValue(macroNodes); 144Contracts.CheckValue(env, nameof(env));
PermutationFeatureImportance.cs (10)
24Contracts.CheckValue(env, nameof(env)); 30Contracts.Assert(predictor != null, "No predictor found in model"); 65Contracts.Check(roleMappedData.Schema.Feature != null, "Feature column not found."); 66Contracts.Check(roleMappedData.Schema.Label != null, "Label column not found."); 77throw Contracts.Except( 105Contracts.Assert(slotNames.Length == permutationMetrics.Length, 162Contracts.Assert(slotNames.Length == permutationMetrics.Length, 221Contracts.Assert(slotNames.Length == permutationMetrics.Length, 257Contracts.Check(roleMappedData.Schema.Group != null, "Group ID column not found."); 275Contracts.Assert(slotNames.Length == permutationMetrics.Length,
ScoreColumnSelector.cs (2)
26Contracts.CheckValue(env, nameof(env)); 68Contracts.CheckValue(env, nameof(env));
ScoreModel.cs (3)
70Contracts.CheckValue(env, nameof(env)); 102Contracts.CheckValue(env, nameof(env)); 118Contracts.CheckValue(env, nameof(env));
TrainTestSplit.cs (1)
45Contracts.CheckValue(env, nameof(env));
Microsoft.ML.Fairlearn (3)
Metrics\FairlearnMetricCatalog.cs (3)
81Contracts.Assert(truths.Count() == predicted.Count()); 82Contracts.Assert(truths.Count() == scores.Count()); 83Contracts.Assert(GroupIds.Count() == truths.Count());
Microsoft.ML.FastTree (484)
BinFile\BinFinder.cs (14)
68Contracts.Assert(valueBuffer.Length >= explicitValuesCount); 93Contracts.Assert(curr > last); 108Contracts.Assert(curr > 0); 117Contracts.Assert(curr == distinctValues[idist]); 136Contracts.Assert(0 <= numValues && numValues <= distinctValues.Length); 137Contracts.Assert(numValues <= counts.Length); 155Contracts.Assert(bad == 0, "distinctValues passed to FindBinsFromDistinctCounts contains non-finite values"); 156Contracts.Assert(inv == 0, "distinctValues passed to FindBinsFromDistinctCounts is not sorted"); 197Contracts.Assert(0 <= numDistinct && numDistinct <= Utils.Size(distinctCounts)); 198Contracts.Assert(minPerLeaf >= 0); 229Contracts.Assert(maxBins > 0); 230Contracts.Assert(minPerLeaf >= 0); 269Contracts.Assert(a < b); 271Contracts.Assert(a <= ave);
BoostingFastTree.cs (1)
77Contracts.CheckValue(ch, nameof(ch));
Dataset\Dataset.cs (26)
46Contracts.AssertValue(datasetSkeleton); 47Contracts.AssertValue(flocks); 48Contracts.Assert(flocks.All(f => f.Examples == datasetSkeleton.NumDocs)); 59Contracts.AssertValue(_flocks[i - 1]); 63Contracts.AssertValue(lastFlock); 65Contracts.Assert(numFeatures == _flocks.Sum(f => f.Count)); 88Contracts.Assert(0 <= feature && feature < NumFeatures); 91Contracts.Assert(0 <= flock && flock < NumFlocks); 92Contracts.Assert(0 <= subfeature && subfeature < _flocks[flock].Count); 102Contracts.Assert(0 <= flock && flock < NumFlocks); 247Contracts.Assert(0 <= feature && feature < _featureToFlock.Length); 391Contracts.Assert(activeFeatures == null || activeFeatures.Length >= NumFeatures); 504Contracts.Check(Ratings != null && Boundaries != null && QueryIds != null && DocIds != null && MaxDcg != null, 507Contracts.Check(Ratings.Length == DocIds.Length, "Length of label array does not match length of docID array"); 508Contracts.Check(Boundaries.Length == QueryIds.Length + 1, "Length of boundaries array does not match length of queryID array"); 509Contracts.Check(Utils.Size(MaxDcg) == 0 || Utils.Size(MaxDcg[0]) == QueryIds.Length, "Length of MaxDCG does not match number of queries"); 579throw Contracts.Except("In Dataset.Split(), fractions must sum to 1.0"); 826throw Contracts.Except("On auxiliary data {0}, disagreement on whether this is query/doc", name); 846throw Contracts.Except("When combining auxiliary data, the types of elements must match. Distinct types {0} detected for data named {1}", 871throw Contracts.Except( 936Contracts.AssertValue(_indexer._flockIndexers[flock]); 943Contracts.AssertValue(indexer); 944Contracts.Assert(0 <= rowIndex && rowIndex < indexer._dataset.NumDocs); 958Contracts.AssertValue(dataset); 959Contracts.Assert(active == null || active.Length == dataset.NumFeatures); 982Contracts.Assert(Enumerable.Range(0, _dataset.NumFlocks).All(f =>
Dataset\DenseIntArray.cs (10)
29Contracts.Assert(length >= 0); 109throw Contracts.Except("CSumup returned error {0}", rv); 181Contracts.Assert(0 <= index && index < Length); 187Contracts.Assert(0 <= index && index < Length); 188Contracts.Assert(value == 0); 303Contracts.Assert(0 <= value && value < (1 << 10)); 444Contracts.Assert(0 <= value && value <= byte.MaxValue); 553Contracts.Assert(0 <= value && value < (1 << 4)); 654Contracts.Assert(0 <= value && value <= ushort.MaxValue); 743Contracts.Assert(value >= 0);
Dataset\Feature.cs (1)
89throw Contracts.Except("Impossible!");
Dataset\FeatureFlock.cs (53)
38Contracts.Assert(count >= 0); 79Contracts.Assert(features > 0); 111Contracts.AssertValueOrNull(active); 112Contracts.Assert(active == null || (0 <= featureOffset && featureOffset <= Utils.Size(active) - Flock.Count)); 113Contracts.Assert(_active.Length == Flock.Count); 149Contracts.Assert(Flock == other.Flock); 150Contracts.Assert(_active.Length == other._active.Length); 155Contracts.Assert(_active[f] == other._active[f]); 202Contracts.Assert(0 <= subfeature && subfeature < Flock.Count); 203Contracts.Assert(subfeature <= feature); 204Contracts.Assert(learner.TrainData.FlockToFirstFeature(flock) == feature - subfeature); 209Contracts.Assert(featureUseCount[feature] >= 0); 349Contracts.Assert(min == max); 401Contracts.Assert(0 <= subfeature && subfeature < Flock.Count); 402Contracts.Assert(subfeature <= feature); 403Contracts.Assert(learner.TrainData.FlockToFirstFeature(flock) == feature - subfeature); 404Contracts.Assert(featureUseCount[feature] >= 0); 405Contracts.Assert(Flock.BinCount(subfeature) == 2); 406Contracts.Assert(GetMaxBorder(subfeature) == GetMinBorder(subfeature)); 529Contracts.Assert(min == max); 545Contracts.Assert(0 <= subfeature && subfeature < Flock.Count); 546Contracts.Assert(subfeature <= feature); 547Contracts.Assert(learner.TrainData.FlockToFirstFeature(flock) == feature - subfeature); 548Contracts.Assert(featureUseCount[feature] >= 0); 549Contracts.Assert(Flock.BinCount(subfeature) == 2); 550Contracts.Assert(GetMaxBorder(subfeature) == GetMinBorder(subfeature)); 725Contracts.Assert(min == max); 741Contracts.Assert(0 <= subfeature && subfeature < Flock.Count); 742Contracts.Assert(subfeature <= feature); 743Contracts.Assert(learner.TrainData.FlockToFirstFeature(flock) == feature - subfeature); 744Contracts.Assert(featureUseCount[feature] >= 0); 745Contracts.Assert(Flock.BinCount(subfeature) == 2); 746Contracts.Assert(GetMaxBorder(subfeature) == GetMinBorder(subfeature)); 943Contracts.Assert(other is TSuffStats); 944Contracts.Assert(Flock == other.Flock); 991Contracts.Assert(0 < count); 1018Contracts.Assert(0 <= featureIndex && featureIndex < Count); 1065Contracts.AssertValue(flockIndexer); 1066Contracts.Assert(0 <= feature && feature < flockIndexer.Flock.Count); 1170Contracts.AssertValue(bins); 1171Contracts.AssertValue(binUpperBounds); 1172Contracts.Assert(Utils.Size(hotFeatureStarts) == binUpperBounds.Length + 1); // One more than number of features. 1173Contracts.Assert(hotFeatureStarts[0] == 1); 1174Contracts.Assert(Utils.IsMonotonicallyIncreasing(hotFeatureStarts)); 1175Contracts.Assert(bins.Max() < hotFeatureStarts[hotFeatureStarts.Length - 1]); 1181Contracts.Assert(AllBinUpperBounds.All(x => Utils.Size(x) >= 1)); 1183Contracts.Assert(AllBinUpperBounds.Select((b, f) => HotFeatureStarts[f + 1] - HotFeatureStarts[f] + 1 == b.Length).All(i => i)); 1188Contracts.Assert(0 <= featureIndex && featureIndex < Count); 1194Contracts.Assert(0 <= featureIndex && featureIndex < Count); 1200Contracts.Assert(0 <= featureIndex && featureIndex < Count); 1236Contracts.AssertValue(flock); 1250Contracts.AssertValueOrNull(active); 1251Contracts.Assert(active == null || (0 <= featureOffset && featureOffset <= Utils.Size(active) - Flock.Count));
Dataset\FeatureHistogram.cs (4)
38Contracts.AssertValue(bins); 39Contracts.Assert(bins.Length == 0 || (0 <= numBins && bins.Max() < numBins)); 74throw Contracts.Except("cannot subtract FeatureHistograms of different lengths"); 93Contracts.Assert(pChildSumWeightsByBin != null);
Dataset\IntArray.cs (13)
71Contracts.CheckParam(numValues >= 0, nameof(numValues)); 90Contracts.CheckParam(length >= 0, nameof(length)); 91Contracts.CheckParam(Enum.IsDefined(typeof(IntArrayType), type) && type != IntArrayType.Current, nameof(type)); 92Contracts.CheckParam(Enum.IsDefined(typeof(IntArrayBits), bitsPerItem), nameof(bitsPerItem)); 93Contracts.CheckValue(values, nameof(values)); 99Contracts.Assert(values.All(x => x == 0)); 126Contracts.CheckParam(length >= 0, nameof(length)); 127Contracts.CheckParam(type == IntArrayType.Current || type == IntArrayType.Repeat || type == IntArrayType.Segmented, nameof(type)); 221Contracts.Assert((input.Weights == null) == (histogram.SumWeightsByBin == null)); 235throw Contracts.Except("Feature bin {0} is invalid", featureBin); 245Contracts.AssertValue(histogram.SumWeightsByBin); 246Contracts.AssertValue(input.Weights); 255throw Contracts.Except("Feature bin {0} is invalid", featureBin);
Dataset\NHotFeatureFlock.cs (7)
34throw Contracts.ExceptNotImpl("Lazy Tom"); 55Contracts.AssertValue(flock); 67Contracts.Assert(0 <= featureIndex && featureIndex < _flock.Count); 68Contracts.Assert(0 <= rowIndex && rowIndex < _flock.Bins.Length); 79Contracts.Assert(_nextIndex == rowIndex); 80Contracts.Assert(_pos < _flock._deltas.Length); 81Contracts.Assert(_pos < _flock._values.Length);
Dataset\OneHotFeatureFlock.cs (5)
31Contracts.Assert(0 <= featureIndex && featureIndex < Count); 72Contracts.AssertValue(indexer); 73Contracts.Assert(1 <= min && min < lim); 91Contracts.Assert(0 <= featureIndex && featureIndex < _flock.Count); 102Contracts.AssertValue(flock);
Dataset\RepeatIntArray.cs (3)
54throw Contracts.Except("Length provided to repeat vector is inconsistent with value enumeration"); 61throw Contracts.Except("Use dense arrays for 0 bits"); 78throw Contracts.Except("Use dense arrays for 0 bits");
Dataset\SegmentIntArray.cs (10)
85throw Contracts.Except("Length provided to segment vector is inconsistent with value enumeration"); 93throw Contracts.Except("Length provided to segment vector is inconsistent with value enumeration"); 193throw Contracts.Except("Bits for max item must be in range [0,32], {0} is illegal", bitsForMaxItem); 195throw Contracts.Except("Cannot use more than 21 bits if also storing the actual optimal path"); 241throw Contracts.Except( 263throw Contracts.ExceptNotImpl(); 434throw Contracts.ExceptNotImpl("Segment array pathfinder currently does not support more than 21 bits"); 438throw Contracts.Except("Segment array cannot represent more than 31 bits"); 454throw Contracts.Except("Segment array cannot represent more than 31 bits"); 575throw Contracts.Except("CSumup returned error {0}", rv);
Dataset\SingletonFeatureFlock.cs (12)
25Contracts.AssertValue(bins); 26Contracts.AssertValue(binUpperBounds); 27Contracts.Assert(bins.Length == 0 || bins.Max() < binUpperBounds.Length); 45Contracts.Assert(featureIndex == 0); 51Contracts.Assert(featureIndex == 0); 68Contracts.Assert(featureIndex == 0); 74Contracts.Assert(featureIndex == 0); 89Contracts.Assert(featureIndex == 0); 96Contracts.AssertValue(flock); 115Contracts.AssertValue(flock); 129Contracts.AssertValueOrNull(active); 130Contracts.Assert(active == null || (0 <= featureOffset && featureOffset <= Utils.Size(active) - Flock.Count));
Dataset\SparseIntArray.cs (17)
39throw Contracts.Except("Use dense arrays for 0 bits"); 72throw Contracts.Except("Length provided to sparse vector is inconsistent with value enumeration"); 79throw Contracts.Except("Use dense arrays for 0 bits"); 102Contracts.AssertValue(values); 103Contracts.AssertValue(deltas); 104Contracts.Assert(values.Length == deltas.Length); 105Contracts.Assert(deltas.Sum(d => (long)d) < length); 112throw Contracts.Except("Use dense arrays for 0 bits"); 135throw Contracts.Except("index {0} occurred after {1}", index, currentIndex); 154throw Contracts.Except("Index {0} inconsistent with length {1}", currentIndex, length); 162throw Contracts.Except("Use dense arrays for 0 bits"); 307Contracts.Assert(histogram.SumWeightsByBin != null); 308Contracts.Assert(input.Weights != null); 398Contracts.Assert(histogram.SumWeightsByBin != null); 399Contracts.Assert(input.Weights != null); 520throw Contracts.Except("CSumup sumupdeltasparse {0}", rv); 532Contracts.AssertValue(array);
FastTree.cs (69)
111: base(Contracts.CheckRef(env, nameof(env)).Register(RegisterName), TrainerUtils.MakeR4VecFeature(featureColumnName), label, TrainerUtils.MakeR4ScalarWeightColumn(exampleWeightColumnName), TrainerUtils.MakeU4ScalarColumn(rowGroupColumnName)) 143: base(Contracts.CheckRef(env, nameof(env)).Register(RegisterName), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), label, TrainerUtils.MakeR4ScalarWeightColumn(options.ExampleWeightColumnName), 216Contracts.CheckValue(ch, nameof(ch)); 438Contracts.AssertValue(ch); 585Contracts.Assert(FastTreeTrainerOptions.BaggingSize > 0); 596Contracts.AssertValue(ch); 748Contracts.Assert(numTotalTrees == 0 || bestIteration > 0); 816Contracts.AssertValue(ch); 842Contracts.Check(st != null, "unknown dataset passed to ConstructScoreTracker"); 868Contracts.Check(scores.Length == initScores.Length, "Length of initscores and scores mismatch"); 886throw Contracts.Except("Queried for unknown set"); 932Contracts.AssertValue(host, "host"); 959Contracts.AssertValue(host, "host"); 977Contracts.AssertValue(host, "host"); 1010Contracts.Assert(values.Length == indices.Length); 1011Contracts.Assert(Algorithms.FindFirstGE(binUpperBounds, 0) == 0); 1026Contracts.AssertValue(ch); 1090Contracts.Assert(flockBits == IntArrayBits.Bits32 || binnedValues.All(b => b < limBin)); 1110Contracts.AssertValue(ch); 1164Contracts.Assert(flockBits == IntArrayBits.Bits32 || binnedValues.All(b => b < limBin)); 1192Contracts.AssertValue(ch); 1501Contracts.Assert(Utils.Size(bup) > 0); 1573Contracts.Assert(FeatureMap == null); 1647Contracts.Assert(iFeature >= cursor.SlotIndex); 1653Contracts.Assert(cursor.SlotIndex == iFeature); 1677Contracts.Assert(cursor.SlotIndex >= 0); 1708Contracts.Assert(maxSlots.Count == minSlots.Count); 1946Contracts.AssertValue(ch); 2044Contracts.Assert(flock.Count > 0); 2045Contracts.Assert(iFeature + flock.Count <= FeatureMap.Length); 2117Contracts.Assert(Utils.Size(bup) > 0); 2231Contracts.Assert(Utils.Size(bup) > 0); 2273Contracts.Assert(last < iFeature); 2346Contracts.Assert(limMade < featureLim); 2404Contracts.Assert(_isSparse); 2437Contracts.Assert(0 <= length); 2440Contracts.Assert(_sparse.Count == 0 || _sparse[_sparse.Count - 1].Key < length); 2445Contracts.Assert(_dense.Count <= length); 2461Contracts.Assert(0 <= lim); 2464Contracts.Assert(_sparse.Count == 0 || _sparse[_sparse.Count - 1].Key < lim); 2471Contracts.Assert(prev < kvp.Key); 2493Contracts.Assert(_dense.Count <= lim); 2511Contracts.Assert(0 <= length); 2515Contracts.Assert(_dense.Count <= length); 2533Contracts.Assert(count <= length); 2540Contracts.Assert(Utils.IsIncreasing(0, editor.Indices, count, length)); 2554Contracts.Assert(Utils.Size(binUpperBounds) > 0); 2555Contracts.Assert(0 <= length); 2563Contracts.Assert(_dense.Count <= length); 2570Contracts.AssertValue(_sparse); 2576Contracts.Assert(kvp.Key < length); 2584Contracts.Assert(zeroBin != 0); 2588Contracts.Assert(kvp.Key < length); 2600Contracts.Assert(!_isSparse); 2601Contracts.AssertValue(_dense); 2602Contracts.Assert(_dense.Count <= length); 2646Contracts.Assert(0 <= featureIndex && featureIndex < _featureIndices.Length); 2647Contracts.Assert(rowIndex >= 0); 2651Contracts.Assert(rowIndex > lastRow); 2661Contracts.Assert(sp.Count == 0 || sp[last].Key > lastRow); 2675Contracts.Assert(s.Key == rowIndex); 2693Contracts.AssertValue(values); 2694Contracts.AssertValueOrNull(workArray); 2695Contracts.AssertValue(features); 2696Contracts.Assert(Utils.IsIncreasing(0, features, values.Length)); 2697Contracts.Assert(features.All(i => values[i] != null)); 2701Contracts.AssertValue(workArray); // Should be initialized now. 2734Contracts.AssertValue(env); 2851Contracts.Assert(NumFeatures > MaxSplitFeatIdx);
FastTreeArguments.cs (1)
619Contracts.AssertValue(ectx);
FastTreeClassification.cs (3)
89Contracts.CheckValue(env, nameof(env)); 358Contracts.Check(_nneg > 0 && _npos > 0, "Only one class in training set."); 436Contracts.CheckValue(env, nameof(env));
FastTreeRanking.cs (12)
122Contracts.Assert(labelCol.IsValid); 396Contracts.AssertValueOrNull(tree); 698Contracts.Check(0 <= order[i] && order[i] < numDocuments, "the index to document exceeds range"); 710Contracts.Check(2 <= group && group < numDocuments + 2, "dupeId group exceeds range"); 987Contracts.AssertValue(permutation); 988Contracts.AssertValue(scores); 989Contracts.AssertValue(labels); 990Contracts.Assert(numDocs > 0); 991Contracts.Assert(shift >= 0); 992Contracts.Assert(scores.Length - numDocs >= shift); 993Contracts.Assert(labels.Length - numDocs >= shift); 1085Contracts.CheckValue(env, nameof(env));
FastTreeRegression.cs (5)
129Contracts.AssertValue(ch); 176Contracts.AssertValue(dlabels); 177Contracts.Assert(dlabels.Length == set.NumDocs); 519Contracts.CheckValue(env, nameof(env)); 536Contracts.CheckValue(env, nameof(env));
FastTreeTweedie.cs (5)
139Contracts.AssertValue(ch); 189Contracts.AssertValue(dlabels); 190Contracts.Assert(dlabels.Length == set.NumDocs); 529Contracts.CheckValue(env, nameof(env)); 572Contracts.CheckValue(env, nameof(env));
GamClassification.cs (1)
236Contracts.CheckValue(env, nameof(env));
GamModelParameters.cs (7)
625Contracts.AssertValue(ch); 725Contracts.AssertValue(metricsView); 745Contracts.AssertValue(ch); 813Contracts.AssertValue(context); 814Contracts.Assert(context._pred._inputFeatureToShapeFunctionMap.ContainsKey(index) 841Contracts.AssertValue(context); 842Contracts.Assert(0 <= index && index < context._pred._inputType.Size);
GamRegression.cs (1)
186Contracts.CheckValue(env, nameof(env));
GamTrainer.cs (8)
176: base(Contracts.CheckRef(env, nameof(env)).Register(name), TrainerUtils.MakeR4VecFeature(featureColumnName), label, TrainerUtils.MakeR4ScalarWeightColumn(weightCrowGroupColumnName)) 197: base(Contracts.CheckRef(env, nameof(env)).Register(name), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), 200Contracts.CheckValue(env, nameof(env)); 279Contracts.CheckValue(ch, nameof(ch)); 296Contracts.AssertValue(ch); 646Contracts.Assert(sumWeights != 0); 688Contracts.CheckValue(env, nameof(env)); 702Contracts.CheckValue(env, nameof(env));
RandomForestClassification.cs (2)
108Contracts.CheckValue(env, nameof(env)); 412Contracts.CheckValue(env, nameof(env));
RandomForestRegression.cs (12)
56Contracts.CheckValue(data, nameof(data)); 57Contracts.Check(weights == null || weights.Length == data.Length, "weights"); 65Contracts.Assert(Utils.IsMonotonicallyIncreasing(_data)); 74Contracts.CheckParam(0 <= p && p <= 1, nameof(p), "Probability argument for Quantile function should be between 0 to 1 inclusive"); 189Contracts.Check(ctx.Reader.ReadBoolByte()); 210Contracts.CheckValue(env, nameof(env)); 527Contracts.Assert(_labels.Length == trainData.NumDocs); 546Contracts.AssertValue(options); 547Contracts.Assert(options.ShuffleLabels); 556throw Contracts.ExceptUserArg(nameof(options.ShuffleLabels), 561Contracts.Assert(1 <= lim && lim <= Utils.ArrayMaxSize); 597Contracts.CheckValue(env, nameof(env));
RegressionTree.cs (4)
109throw Contracts.Except($"The input index, {nodeIndex}, is invalid. Its valid range is from 0 (inclusive) to {NumberOfNodes} (exclusive)."); 126throw Contracts.Except($"The input node index, {nodeIndex}, is invalid. Its valid range is from 0 (inclusive) to {NumberOfNodes} (exclusive)."); 214throw Contracts.Except($"The input leaf index, {leafIndex}, is invalid. Its valid range is from 0 (inclusive) to {NumberOfLeaves} (exclusive)."); 230throw Contracts.Except($"The input leaf index, {leafIndex}, is invalid. Its valid range is from 0 (inclusive) to {NumberOfLeaves} (exclusive).");
SumupPerformanceCommand.cs (1)
81Contracts.CheckValue(env, nameof(env));
Training\Applications\ObjectiveFunction.cs (1)
73Contracts.Check(queue.TryDequeue(out threadIndex));
Training\DcgCalculator.cs (1)
194throw Contracts.ExceptParam(nameof(begin));
Training\DcgPermutationComparer.cs (1)
38throw Contracts.ExceptNotSupp("DCGComparer of type '{0}' not supported", name);
Training\DocumentPartitioning.cs (5)
34Contracts.Assert(numDocuments >= 0); 35Contracts.Assert(maxLeaves > 0); 80Contracts.Assert(perChunkDocumentLists[chunkIndex] == null); 110Contracts.Assert(_documents.Length == _leafBegin[tree.NumLeaves - 1] + _leafCount[tree.NumLeaves - 1]); 247Contracts.Assert(bins != null);
Training\EarlyStoppingCriteria.cs (19)
82Contracts.Assert((LowerIsBetter && value <= _bestScore) || value >= _bestScore); 145Contracts.CheckUserArg(threshold >= 0, nameof(threshold), "Must be non-negative."); 153Contracts.CheckUserArg(options.Threshold >= 0, nameof(options.Threshold), "Must be non-negative."); 162Contracts.Assert(validationScore >= 0); 209Contracts.CheckUserArg(0 <= threshold && threshold <= 1, nameof(threshold), "Must be in range [0,1]."); 210Contracts.CheckUserArg(windowSize > 0, nameof(windowSize), "Must be positive."); 220Contracts.CheckUserArg(0 <= threshold && threshold <= 1, nameof(threshold), "Must be in range [0,1]."); 221Contracts.CheckUserArg(windowSize > 0, nameof(windowSize), "Must be positive."); 239Contracts.Assert(recentScores.Count > 0); 315Contracts.CheckUserArg(0 <= threshold && threshold <= 1, nameof(threshold), "Must be in range [0,1]."); 323Contracts.CheckUserArg(0 <= options.Threshold && options.Threshold <= 1, nameof(options.Threshold), "Must be in range [0,1]."); 332Contracts.Assert(validationScore >= 0); 385Contracts.Assert(validationScore >= 0); 386Contracts.Assert(trainingScore >= 0); 442Contracts.Assert(validationScore >= 0); 443Contracts.Assert(trainingScore >= 0); 499Contracts.CheckUserArg(windowSize > 0, nameof(windowSize), "Must be positive"); 507Contracts.CheckUserArg(options.WindowSize > 0, nameof(options.WindowSize), "Must be positive"); 517Contracts.Assert(validationScore >= 0);
Training\OptimizationAlgorithms\AcceleratedGradientDescent.cs (1)
23Contracts.CheckValue(ch, nameof(ch));
Training\OptimizationAlgorithms\ConjugateGradientDescent.cs (1)
23Contracts.AssertValue(ch);
Training\OptimizationAlgorithms\GradientDescent.cs (2)
39Contracts.AssertValue(ch); 96Contracts.CheckValue(ch, nameof(ch));
Training\OptimizationAlgorithms\NoOptimizationAlgorithm.cs (1)
30Contracts.CheckValue(ch, nameof(ch));
Training\ScoreTracker.cs (2)
69throw Contracts.Except("The length of initScores do not match the length of training set"); 135throw Contracts.ExceptNotSupp("This code should not be reachable");
Training\Test.cs (11)
78throw Contracts.Except("Cannot compare unrelated metrics"); 139throw Contracts.Except("Unsupported value operator: {0}", Operator); 303throw Contracts.Except("TestResult don't match"); 348Contracts.Check(scoreTracker.Dataset.NumDocs == labels.Length, "Mismatch between dataset and labels"); 388Contracts.CheckParam(ndcgTruncation == 1 || ndcgTruncation == 3, nameof(ndcgTruncation), 405Contracts.Assert(false); 406throw Contracts.Except(); 450throw Contracts.Except("FastNDCGTest only supports NDCG1 & NDCG3"); 528Contracts.Check(scoreTracker.Dataset.NumDocs == _labels.Length, "Mismatch between dataset and labels"); 569Contracts.Assert(_resultType == null || _resultType == 1 || _resultType == 2); 602Contracts.Check(scoreTracker.Dataset.NumDocs == binaryLabels.Length, "Mismatch between dataset and labels");
Training\TreeLearners\LeastSquaresRegressionTreeLearner.cs (19)
298Contracts.Assert(TrainData.Flocks[bestSplitInfo.Flock] is OneHotFeatureFlock); 309Contracts.Assert(localIndex >= 0); 320Contracts.Assert(bestSplitInfo.GTCount < 0 || Partitioning.NumDocsInLeaf(gtChild) == bestSplitInfo.GTCount 534Contracts.Assert(ParentHistogramArray[flock].Flock == smallStats.Flock); 582Contracts.Assert(0 <= min && min <= lim && lim <= TrainData.NumFeatures); 625Contracts.Assert(sumWeights != 0); 645Contracts.Assert(sumWeights != 0); 672Contracts.AssertValue(histogram); 673Contracts.AssertValue(leafSplitCandidates); 674Contracts.Assert(0 <= flock && flock < TrainData.NumFlocks); 675Contracts.Assert(histogram.Flock == TrainData.Flocks[flock]); 1134Contracts.CheckValue(buffer, nameof(buffer)); 1135Contracts.Check(0 <= offset && offset + size <= buffer.Length); 1152Contracts.Check(CategoricalSplitRange.Length == 2); 1155Contracts.Check(offset - startIndex <= size); 1161Contracts.CheckValue(buffer, nameof(buffer)); 1162Contracts.Check(0 <= offset && offset + size <= buffer.Length); 1180Contracts.Check(CategoricalSplitRange.Length == 2); 1182Contracts.Check(offset - startIndex <= size);
TreeEnsemble\InternalQuantileRegressionTree.cs (2)
81Contracts.Check(sampleCount == _labelsDistribution.Length / NumLeaves, "Bad quantile sample count"); 82Contracts.Check(_instanceWeights == null || sampleCount == _instanceWeights.Length / NumLeaves, "Bad quantile weight count");
TreeEnsemble\InternalRegressionTree.cs (54)
134Contracts.Assert(indices.Length <= NumNodes); 138Contracts.Assert(index >= 0 && index < NumNodes); 151Contracts.Assert(indices.Length <= NumNodes); 155Contracts.Assert(index >= 0 && index < NumNodes); 179Contracts.CheckParam(numLeaves - 1 == Utils.Size(splitFeatures), nameof(splitFeatures), "Size error, should equal to numLeaves - 1."); 180Contracts.CheckParam(numLeaves - 1 == Utils.Size(splitGain), nameof(splitGain), "Size error, should equal to numLeaves - 1."); 181Contracts.CheckParam(numLeaves - 1 == Utils.Size(rawThresholds), nameof(rawThresholds), "Size error, should equal to numLeaves - 1."); 182Contracts.CheckParam(numLeaves - 1 == Utils.Size(lteChild), nameof(lteChild), "Size error, should equal to numLeaves - 1."); 183Contracts.CheckParam(numLeaves - 1 == Utils.Size(gtChild), nameof(gtChild), "Size error, should equal to numLeaves - 1."); 184Contracts.CheckParam(numLeaves - 1 == Utils.Size(defaultValueForMissing), nameof(defaultValueForMissing), "Size error, should equal to numLeaves - 1."); 185Contracts.CheckParam(numLeaves == Utils.Size(leafValues), nameof(leafValues), "Size error, should equal to numLeaves."); 186Contracts.CheckParam(numLeaves - 1 == Utils.Size(categoricalSplitFeatures), nameof(categoricalSplitFeatures), "Size error, should equal to numLeaves - 1."); 187Contracts.CheckParam(numLeaves - 1 == Utils.Size(categoricalSplit), nameof(categoricalSplit), "Size error, should equal to numLeaves - 1."); 197Contracts.CheckParam(Utils.Size(splitFeatures) > 0, nameof(splitFeatures), "Number of split features must be positive"); 218Contracts.Assert(categoricalSplit[i]); 223CheckValid(Contracts.Check); 289Contracts.Assert(CategoricalSplit[index]); 290Contracts.Assert(index >= 0 && index < NumNodes); 313CheckValid(Contracts.CheckDecode); 337CheckValid((t, s) => Contracts.Assert(t, s)); 376Contracts.Assert(CategoricalSplit != null); 377Contracts.Assert(CategoricalSplit.Length >= NumNodes); 392Contracts.Assert(indexLocal >= 0 && indexLocal < NumNodes); 393Contracts.Assert(CategoricalSplitFeatures[indexLocal] != null && 396Contracts.Assert(CategoricalSplitFeatureRanges[indexLocal] != null && 428throw Contracts.ExceptNotSupp("Affine regression trees unsupported"); 432throw Contracts.ExceptDecode(); 540Contracts.AssertValue(CategoricalSplitFeatureRanges); 560throw Contracts.Except("cannot sumup value with different lengths"); 586throw Contracts.Except("trees from different workers do not match"); 840Contracts.Assert(path == null || path.Count == 0); 841Contracts.Assert(root >= 0); 855Contracts.Assert(CategoricalSplitFeatures != null); 888Contracts.Assert(CategoricalSplitFeatures != null); 918Contracts.Assert(featIndices.Length == featValues.Length); 919Contracts.Assert(path == null || path.Count == 0); 920Contracts.Assert(root >= 0); 937Contracts.Assert(CategoricalSplitFeatures != null); 938Contracts.Assert(CategoricalSplitFeatureRanges != null); 1042Contracts.Assert(CategoricalSplitFeatureRanges == null); 1131Contracts.AssertValue(oldToNewFeatures); 1136Contracts.Assert(0 <= SplitFeatures[n] && SplitFeatures[n] < oldToNewFeatures.Length); 1140Contracts.Assert(CategoricalSplitFeatures[n] != null); 1141Contracts.Assert(CategoricalSplitFeatureRanges[n] != null && 1170Contracts.AssertValue(sbEvaluator); 1171Contracts.AssertValue(sbInput); 1172Contracts.AssertValue(featureContents); 1252Contracts.AssertValue(sbEvaluator); 1253Contracts.AssertValue(sbInput); 1254Contracts.AssertValue(featureContents); 1255Contracts.Assert(CategoricalSplitFeatures.Length == NumNodes); 1347Contracts.Assert(-NumLeaves <= node && node < NumNodes); 1468throw Contracts.Except("Cannot swap root or leaves"); 1548Contracts.Assert(CategoricalSplitFeatures != null);
TreeEnsemble\InternalTreeEnsemble.cs (8)
52Contracts.CheckDecode(numTrees >= 0); 104Contracts.AssertValue(oldToNewFeatures); 439Contracts.AssertValue(schema); 440Contracts.Assert(schema.Feature.HasValue); 443Contracts.Assert(featValueCount > 0); 451Contracts.Assert(_names.Length == _content.Length); 456Contracts.Assert(0 <= ifeat && ifeat < Count); 463Contracts.Assert(0 <= ifeat && ifeat < Count);
TreeEnsembleFeaturizationTransformer.cs (2)
72base(Contracts.CheckRef(env, nameof(env)).Register(nameof(TreeEnsembleFeaturizationTransformer)), modelParameters, inputSchema) 105: base(Contracts.CheckRef(host, nameof(host)).Register(nameof(TreeEnsembleFeaturizationTransformer)), ctx)
TreeEnsembleFeaturizer.cs (12)
107Contracts.AssertValue(ectx); 245Contracts.AssertValue(ectx); 399Contracts.CheckValue(env, nameof(env)); 425Contracts.CheckValue(env, nameof(env)); 464Contracts.AssertValue(ensemble); 524Contracts.AssertValue(env); 598Contracts.CheckValue(env, nameof(env)); 614Contracts.CheckValue(env, nameof(env)); 646Contracts.Assert(data.Schema.Feature.HasValue); 695Contracts.CheckValue(env, nameof(env)); 794Contracts.AssertValue(env); 825Contracts.CheckValue(env, nameof(env));
TreeTrainersCatalog.cs (29)
45Contracts.CheckValue(catalog, nameof(catalog)); 65Contracts.CheckValue(catalog, nameof(catalog)); 66Contracts.CheckValue(options, nameof(options)); 99Contracts.CheckValue(catalog, nameof(catalog)); 119Contracts.CheckValue(catalog, nameof(catalog)); 120Contracts.CheckValue(options, nameof(options)); 155Contracts.CheckValue(catalog, nameof(catalog)); 175Contracts.CheckValue(catalog, nameof(catalog)); 176Contracts.CheckValue(options, nameof(options)); 207Contracts.CheckValue(catalog, nameof(catalog)); 227Contracts.CheckValue(catalog, nameof(catalog)); 257Contracts.CheckValue(catalog, nameof(catalog)); 277Contracts.CheckValue(catalog, nameof(catalog)); 309Contracts.CheckValue(catalog, nameof(catalog)); 329Contracts.CheckValue(catalog, nameof(catalog)); 330Contracts.CheckValue(options, nameof(options)); 361Contracts.CheckValue(catalog, nameof(catalog)); 381Contracts.CheckValue(catalog, nameof(catalog)); 382Contracts.CheckValue(options, nameof(options)); 413Contracts.CheckValue(catalog, nameof(catalog)); 433Contracts.CheckValue(catalog, nameof(catalog)); 434Contracts.CheckValue(options, nameof(options)); 456Contracts.CheckValue(catalog, nameof(catalog)); 477Contracts.CheckValue(catalog, nameof(catalog)); 498Contracts.CheckValue(catalog, nameof(catalog)); 519Contracts.CheckValue(catalog, nameof(catalog)); 540Contracts.CheckValue(catalog, nameof(catalog)); 561Contracts.CheckValue(catalog, nameof(catalog)); 582Contracts.CheckValue(catalog, nameof(catalog));
Utils\Algorithms.cs (2)
25throw Contracts.Except("value is greater than the greatest number in the array"); 61throw Contracts.Except("value is less than the first array element");
Utils\BufferPoolManager.cs (2)
78Contracts.AssertValueOrNull(buffer); 90Contracts.Assert(tmp);
Utils\ThreadTaskManager.cs (2)
26Contracts.Assert(numThreads > 0); 27Contracts.Assert(NumThreads == 0);
Microsoft.ML.ImageAnalytics (126)
ImageGrayscale.cs (8)
49Contracts.AssertValue(sb); 90: base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), columns) 97Contracts.CheckValue(env, nameof(env)); 109Contracts.CheckValue(env, nameof(env)); 164Contracts.AssertValue(input); 165Contracts.Assert(0 <= iinfo && iinfo < _parent.ColumnPairs.Length); 193Contracts.Assert(dst.Width == src.Width && dst.Height == src.Height); 238: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ImageGrayscalingEstimator)), new ImageGrayscalingTransformer(env, columns))
ImageLoader.cs (9)
42Contracts.AssertNonEmpty(str); 52Contracts.AssertValue(sb); 104: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ImageLoadingTransformer)), columns) 129Contracts.CheckValue(env, nameof(env)); 218Contracts.AssertValue(input); 219Contracts.Assert(0 <= iinfo && iinfo < _parent.ColumnPairs.Length); 265Contracts.AssertValue(input); 266Contracts.Assert(0 <= iinfo && iinfo < _parent.ColumnPairs.Length); 428: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ImageLoadingEstimator)), transformer)
ImagePixelExtractor.cs (49)
69Contracts.AssertNonEmpty(str); 79Contracts.AssertValue(sb); 182: base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), GetColumnPairs(columns)) 189Contracts.CheckValue(columns, nameof(columns)); 196Contracts.CheckValue(env, nameof(env)); 216Contracts.CheckValue(env, nameof(env)); 296Contracts.AssertValue(input); 297Contracts.Assert(0 <= iinfo && iinfo < _parent._columns.Length); 310Contracts.Assert(dims.Length == 3); 319Contracts.Assert(size > 0); 320Contracts.Assert(size == planes * height * width); 340Contracts.AssertValueOrNull(src); 354Contracts.Assert(scale != 0); 359Contracts.Assert(!vf.IsEmpty || !vb.IsEmpty); 361Contracts.Assert(!needScale || !vf.IsEmpty); 411Contracts.Assert(idst == size); 458Contracts.Assert(column.Planes > 0); 461Contracts.Assert(type != null); 465Contracts.Assert(height > 0); 466Contracts.Assert(width > 0); 467Contracts.Assert((long)height * width <= int.MaxValue / 4); 613Contracts.CheckValue(item, nameof(item)); 614Contracts.CheckValue(options, nameof(options)); 622Contracts.CheckUserArg(Planes > 0, nameof(item.UseRed), "Need to use at least one color plane"); 637Contracts.CheckUserArg(FloatUtils.IsFinite(OffsetImage), nameof(item.Offset)); 638Contracts.CheckUserArg(FloatUtils.IsFiniteNonZero(ScaleImage), nameof(item.Scale)); 663Contracts.CheckNonWhiteSpace(name, nameof(name)); 673Contracts.CheckParam(Planes > 0, nameof(colorsToExtract), "Need to use at least one color plane."); 688Contracts.CheckParam(FloatUtils.IsFinite(OffsetImage), nameof(offsetImage)); 689Contracts.CheckParam(FloatUtils.IsFiniteNonZero(ScaleImage), nameof(scaleImage)); 694Contracts.AssertNonEmpty(name); 695Contracts.AssertNonEmpty(inputColumnName); 696Contracts.AssertValue(ctx); 709Contracts.CheckDecode(ColorsToExtract != 0); 710Contracts.CheckDecode((ColorsToExtract & ImagePixelExtractingEstimator.ColorBits.All) == ColorsToExtract); 716Contracts.CheckDecode(OrderOfExtraction != 0); 724Contracts.Assert(0 < Planes && Planes <= 4); 728Contracts.CheckDecode(FloatUtils.IsFinite(OffsetImage)); 730Contracts.CheckDecode(FloatUtils.IsFiniteNonZero(ScaleImage)); 731Contracts.CheckDecode(OutputAsFloatArray || OffsetImage == 0 && ScaleImage == 1); 737Contracts.AssertValue(ctx); 743Contracts.Assert(planes == Planes); 753Contracts.Assert(ColorsToExtract != 0); 754Contracts.Assert((ColorsToExtract & ImagePixelExtractingEstimator.ColorBits.All) == ColorsToExtract); 758Contracts.Assert(FloatUtils.IsFinite(OffsetImage)); 760Contracts.Assert(FloatUtils.IsFiniteNonZero(ScaleImage)); 761Contracts.Assert(OutputAsFloatArray || OffsetImage == 0 && ScaleImage == 1); 790: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ImagePixelExtractingEstimator)), 801: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ImagePixelExtractingEstimator)), new ImagePixelExtractingTransformer(env, columns))
ImageResizer.cs (17)
53Contracts.AssertNonEmpty(str); 63Contracts.AssertValue(sb); 139: base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), GetColumnPairs(columns)) 146Contracts.CheckValue(columns, nameof(columns)); 153Contracts.CheckValue(env, nameof(env)); 178Contracts.CheckValue(env, nameof(env)); 244Contracts.Assert((ImageResizingEstimator.ResizingKind)(byte)col.Resizing == col.Resizing); 246Contracts.Assert((ImageResizingEstimator.Anchor)(byte)col.Anchor == col.Anchor); 274Contracts.AssertValue(input); 275Contracts.Assert(0 <= iinfo && iinfo < _parent._columns.Length); 327Contracts.Assert(dst.Width == info.ImageWidth && dst.Height == info.ImageHeight); 453Contracts.CheckNonEmpty(name, nameof(name)); 454Contracts.CheckUserArg(imageWidth > 0, nameof(imageWidth)); 455Contracts.CheckUserArg(imageHeight > 0, nameof(imageHeight)); 456Contracts.CheckUserArg(Enum.IsDefined(typeof(ResizingKind), resizing), nameof(resizing)); 457Contracts.CheckUserArg(Enum.IsDefined(typeof(Anchor), anchor), nameof(anchor)); 501: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ImageResizingEstimator)), transformer)
ImageType.cs (5)
40Contracts.CheckParam(width > 0, nameof(width), "Should be positive number"); 41Contracts.CheckParam(height > 0, nameof(height), "Should be positive number"); 78Contracts.CheckParam(height > 0, nameof(height), "Must be positive."); 79Contracts.CheckParam(width > 0, nameof(width), " Must be positive."); 80Contracts.CheckParam((long)height * width <= int.MaxValue / 4, nameof(height), nameof(height) + " * " + nameof(width) + " is too large.");
VectorToImageTransform.cs (38)
83Contracts.AssertNonEmpty(str); 93Contracts.AssertValue(sb); 179: base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), GetColumnPairs(columns)) 220Contracts.CheckValue(env, nameof(env)); 254Contracts.CheckValue(env, nameof(env)); 293Contracts.CheckValue(columns, nameof(columns)); 341throw Contracts.Except("We only support float, double or byte arrays"); 347Contracts.Assert(typeof(TValue) == srcType.RawType); 498Contracts.CheckValue(item, nameof(item)); 499Contracts.CheckValue(args, nameof(args)); 512Contracts.CheckUserArg(Planes > 0, nameof(item.ContainsRed), "Need to use at least one color plane"); 521Contracts.CheckUserArg(FloatUtils.IsFinite(OffsetImage), nameof(item.Offset)); 522Contracts.CheckUserArg(FloatUtils.IsFiniteNonZero(ScaleImage), nameof(item.Scale)); 527Contracts.AssertNonEmpty(outputColumnName); 528Contracts.AssertNonEmpty(inputColumnName); 529Contracts.AssertValue(ctx); 547Contracts.CheckDecode(Colors != 0); 548Contracts.CheckDecode((Colors & ImagePixelExtractingEstimator.ColorBits.All) == Colors); 555Contracts.Assert(0 < Planes && Planes <= 4); 562Contracts.CheckDecode(Order != 0); 566Contracts.CheckDecode(ImageWidth > 0); 568Contracts.CheckDecode(ImageHeight > 0); 570Contracts.CheckDecode(FloatUtils.IsFinite(OffsetImage)); 572Contracts.CheckDecode(FloatUtils.IsFiniteNonZero(ScaleImage)); 618Contracts.CheckNonWhiteSpace(name, nameof(name)); 631Contracts.CheckParam(Planes > 0, nameof(colorsPresent), "Need to use at least one color plane"); 636Contracts.CheckParam(imageWidth > 0, nameof(imageWidth), "Image width must be greater than zero"); 637Contracts.CheckParam(imageHeight > 0, nameof(imageHeight), "Image height must be greater than zero"); 638Contracts.CheckParam(FloatUtils.IsFinite(offsetImage), nameof(offsetImage)); 639Contracts.CheckParam(FloatUtils.IsFiniteNonZero(scaleImage), nameof(scaleImage)); 652Contracts.AssertValue(ctx); 659Contracts.Assert(planes == Planes); 673Contracts.Assert(Colors != 0); 674Contracts.Assert((Colors & ImagePixelExtractingEstimator.ColorBits.All) == Colors); 679Contracts.Assert(FloatUtils.IsFinite(OffsetImage)); 681Contracts.Assert(FloatUtils.IsFiniteNonZero(ScaleImage)); 724: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(VectorToImageConvertingEstimator)), 735: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(VectorToImageConvertingEstimator)), new VectorToImageConvertingTransformer(env, columnOptions))
Microsoft.ML.KMeansClustering (50)
KMeansCatalog.cs (3)
35Contracts.CheckValue(catalog, nameof(catalog)); 60Contracts.CheckValue(catalog, nameof(catalog)); 61Contracts.CheckValue(options, nameof(options));
KMeansModelParameters.cs (4)
243Contracts.Assert(_centroids[i].Length == _dimensionality); 248Contracts.Assert(FloatUtils.IsFinite(values)); 258Contracts.CheckValue(env, nameof(env)); 282Contracts.Assert(_centroids.Length == _k);
KMeansPlusPlusTrainer.cs (43)
171: base(Contracts.CheckRef(env, nameof(env)).Register(LoadNameValue), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), default, TrainerUtils.MakeR4ScalarWeightColumn(options.ExampleWeightColumnName)) 203Contracts.Assert(dimensionality > 0); 293Contracts.CheckValue(env, nameof(env)); 471Contracts.AssertValue(factory); 472Contracts.AssertValue(ch); 473Contracts.Assert(totalTrainingInstances > 0); 474Contracts.Assert(baseMaxInstancesToAccelerate >= 0); 514Contracts.AssertValue(factory); 527Contracts.Check(lookup.Count == n); 572Contracts.AssertValue(factory); 573Contracts.AssertValue(ch); 574Contracts.Assert(numRounds > 0); 575Contracts.Assert(numSamplesPerRound > 0); 576Contracts.Assert(totalTrainingInstances > 0); 579Contracts.Assert(_acceleratedRowMap.MaxInstancesToAccelerate >= 0, 619Contracts.Assert(0 <= n && n < _acceleratedRowMap.MaxInstancesToAccelerate); 620Contracts.AssertValue(_clusterDistances); 621Contracts.Assert(0 <= bestCluster && bestCluster < _clusterDistances.GetLength(1), "bestCluster must be between 0..clusterCount-1"); 637Contracts.Assert(newClusterL2 >= 0); 638Contracts.Assert(0 <= newClusterIdxWithinSample && newClusterIdxWithinSample < _clusterDistances.GetLength(0), "newClusterIdxWithinSample must be between 0..numSamplesPerRound-1"); 639Contracts.Assert(0 <= oldClusterIdx && oldClusterIdx < _clusterDistances.GetLength(1)); 653Contracts.Assert(instanceDistanceToBestOldCluster >= 0); 654Contracts.Assert(0 <= newClusterIdxWithinSample && newClusterIdxWithinSample < _clusterDistances.GetLength(0), 656Contracts.Assert((_clusterDistances == null) || (bestOldCluster == -1 || 688Contracts.AssertValue(initializationState); 689Contracts.Assert(clusterCount > 0); 690Contracts.Assert(0 <= clusterPrevCount && clusterPrevCount < clusterCount); 691Contracts.AssertValue(clusters); 692Contracts.AssertValue(clustersL2s); 720Contracts.Assert(-2 * VectorUtils.DotProduct(in point, in clusters[j]) + clustersL2s[j] > bestWeight); 789Contracts.CheckValue(host, nameof(host)); 1171Contracts.Assert(FloatUtils.IsFinite(reducedState.AverageScore)); 1273Contracts.AssertValue(ch); 1319Contracts.Assert(n != -1); 1338Contracts.Assert(KMeansLloydsYinYangTrain.AlmostLeq(bestDistance, _upperBound[n])); 1345Contracts.Assert(AlmostLeq(_lowerBound[n], distance)); 1436Contracts.Assert(AlmostEq(reducedStateCacheValues[j], cachedSumCopyValues[j])); 1792Contracts.Assert(centroids.Length >= centroidCount && centroidL2s.Length >= centroidCount && centroidCount > 0); 1793Contracts.Assert(features.Length == centroids[0].Length); 1821Contracts.Assert(FloatUtils.IsFinite(minDistance)); 1822Contracts.Assert(centroidCount == 1 || (FloatUtils.IsFinite(secMinDistance) && secCluster >= 0)); 1823Contracts.Assert(minDistance <= secMinDistance); 1840Contracts.Check(centroid.Items().Select(x => x.Value).All(FloatUtils.IsFinite), "Model training failed: non-finite coordinates are generated");
Microsoft.ML.LightGbm (63)
LightGbmArguments.cs (11)
49Contracts.CheckUserArg(options.MinimumSplitGain >= 0, nameof(OptionsBase.MinimumSplitGain), "must be >= 0."); 50Contracts.CheckUserArg(options.MinimumChildWeight >= 0, nameof(OptionsBase.MinimumChildWeight), "must be >= 0."); 51Contracts.CheckUserArg(options.SubsampleFraction > 0 && options.SubsampleFraction <= 1, nameof(OptionsBase.SubsampleFraction), "must be in (0,1]."); 52Contracts.CheckUserArg(options.FeatureFraction > 0 && options.FeatureFraction <= 1, nameof(OptionsBase.FeatureFraction), "must be in (0,1]."); 53Contracts.CheckUserArg(options.L2Regularization >= 0, nameof(OptionsBase.L2Regularization), "must be >= 0."); 54Contracts.CheckUserArg(options.L1Regularization >= 0, nameof(OptionsBase.L1Regularization), "must be >= 0."); 298Contracts.CheckUserArg(options.TreeDropFraction > 0 && options.TreeDropFraction < 1, nameof(options.TreeDropFraction), "must be in (0,1)."); 299Contracts.CheckUserArg(options.SkipDropFraction >= 0 && options.SkipDropFraction < 1, nameof(options.SkipDropFraction), "must be in [0,1)."); 344Contracts.CheckUserArg(options.TopRate > 0 && options.TopRate < 1, nameof(Options.TopRate), "must be in (0,1)."); 345Contracts.CheckUserArg(options.OtherRate >= 0 && options.OtherRate < 1, nameof(Options.OtherRate), "must be in [0,1)."); 346Contracts.Check(options.TopRate + options.OtherRate <= 1, "Sum of topRate and otherRate cannot be larger than 1.");
LightGbmBinaryTrainer.cs (4)
77Contracts.CheckValue(env, nameof(env)); 196Contracts.CheckUserArg(options.Sigmoid > 0, nameof(Options.Sigmoid), "must be > 0."); 197Contracts.CheckUserArg(options.WeightOfPositiveExamples > 0, nameof(Options.WeightOfPositiveExamples), "must be > 0."); 316Contracts.CheckValue(env, nameof(env));
LightGbmCatalog.cs (12)
46Contracts.CheckValue(catalog, nameof(catalog)); 66Contracts.CheckValue(catalog, nameof(catalog)); 82Contracts.CheckValue(catalog, nameof(catalog)); 114Contracts.CheckValue(catalog, nameof(catalog)); 134Contracts.CheckValue(catalog, nameof(catalog)); 150Contracts.CheckValue(catalog, nameof(catalog)); 184Contracts.CheckValue(catalog, nameof(catalog)); 205Contracts.CheckValue(catalog, nameof(catalog)); 221Contracts.CheckValue(catalog, nameof(catalog)); 253Contracts.CheckValue(catalog, nameof(catalog)); 273Contracts.CheckValue(catalog, nameof(catalog)); 289Contracts.CheckValue(catalog, nameof(catalog));
LightGbmMulticlassTrainer.cs (3)
137Contracts.CheckUserArg(options.Sigmoid > 0, nameof(Options.Sigmoid), "must be > 0."); 364Contracts.Assert(success); 398Contracts.CheckValue(env, nameof(env));
LightGbmRankingTrainer.cs (3)
179Contracts.CheckUserArg(options.Sigmoid > 0, nameof(Options.Sigmoid), "must be > 0."); 270Contracts.Assert(labelCol.IsValid); 328Contracts.CheckValue(env, nameof(env));
LightGbmRegressionTrainer.cs (2)
72Contracts.CheckValue(env, nameof(env)); 276Contracts.CheckValue(env, nameof(env));
LightGbmTrainerBase.cs (12)
283Contracts.CheckValue(host, nameof(host)); 367: base(Contracts.CheckRef(env, nameof(env)).Register(name), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), label, 371Contracts.CheckUserArg(options.NumberOfIterations >= 0, nameof(options.NumberOfIterations), "must be >= 0."); 372Contracts.CheckUserArg(options.MaximumBinCountPerFeature > 0, nameof(options.MaximumBinCountPerFeature), "must be > 0."); 373Contracts.CheckUserArg(options.MinimumExampleCountPerGroup > 0, nameof(options.MinimumExampleCountPerGroup), "must be > 0."); 374Contracts.CheckUserArg(options.MaximumCategoricalSplitPointCount > 0, nameof(options.MaximumCategoricalSplitPointCount), "must be > 0."); 375Contracts.CheckUserArg(options.CategoricalSmoothing >= 0, nameof(options.CategoricalSmoothing), "must be >= 0."); 376Contracts.CheckUserArg(options.L2CategoricalRegularization >= 0.0, nameof(options.L2CategoricalRegularization), "must be >= 0."); 504Contracts.CheckValue(ParallelTraining.GetReduceScatterFunction(), nameof(ParallelTraining.GetReduceScatterFunction)); 505Contracts.CheckValue(ParallelTraining.GetAllgatherFunction(), nameof(ParallelTraining.GetAllgatherFunction)); 1153Contracts.Assert(slot >= lastIdx); 1156Contracts.Assert(lastIdx == slot);
WrappedLightGbmBooster.cs (2)
40Contracts.Assert(numEval <= 1); 238Contracts.Check(kv.Length == 2);
WrappedLightGbmDataset.cs (13)
89Contracts.Assert(GetNumCols() == numCol); 90Contracts.Assert(GetNumRows() == numTotalRow); 120Contracts.Assert(startRowIdx == _lastPushedRowID); 121Contracts.Assert(numCol == GetNumCols()); 122Contracts.Assert(numRow > 0); 123Contracts.Assert(startRowIdx <= GetNumRows() - numRow); 131Contracts.Assert(startRowIdx == _lastPushedRowID); 132Contracts.Assert(numCol == GetNumCols()); 133Contracts.Assert(startRowIdx < GetNumRows()); 156Contracts.AssertValue(labels); 157Contracts.Assert(labels.Length == GetNumRows()); 167Contracts.Assert(weights.Length == GetNumRows()); 202Contracts.Assert(initScores.Length % GetNumRows() == 0);
WrappedLightGbmInterface.cs (1)
243throw Contracts.Except("LightGBM Error, code is {0}, error message is '{1}'.", res, mes);
Microsoft.ML.Maml (14)
ChainCommand.cs (1)
38Contracts.CheckValue(env, nameof(env));
HelpCommand.cs (6)
76Contracts.CheckValue(env, nameof(env)); 414Contracts.AssertNonEmpty(kind); 415Contracts.AssertValue(info); 416Contracts.AssertValueOrNull(args); 426Contracts.AssertValue(components); 445Contracts.CheckValue(env, nameof(env));
MAML.cs (6)
239Contracts.AssertValue(writer); 240Contracts.AssertValue(ex); 260Contracts.AssertValue(ch); 278if (Contracts.IsMarkedKey.Equals(kvp.Key)) 280if (Contracts.SensitivityKey.Equals(kvp.Key)) 314Contracts.AssertValue(ch);
VersionCommand.cs (1)
24Contracts.CheckValue(env, nameof(env));
Microsoft.ML.Mkl.Components (94)
ComputeLRTrainingStdThroughHal.cs (7)
29Contracts.AssertValue(ch); 30Contracts.AssertValue(hessian, nameof(hessian)); 31Contracts.Assert(numSelectedParams > 0); 32Contracts.Assert(currentWeightsCount > 0); 33Contracts.Assert(l2Weight > 0); 49Contracts.Assert(hessian == null); 85Contracts.Assert(ioffset == invHessian.Length);
MklComponentsCatalog.cs (6)
38Contracts.CheckValue(catalog, nameof(catalog)); 66Contracts.CheckValue(catalog, nameof(catalog)); 67Contracts.CheckValue(options, nameof(options)); 94Contracts.CheckValue(catalog, nameof(catalog)); 124Contracts.CheckValue(catalog, nameof(catalog)); 125Contracts.CheckValue(options, nameof(options));
OlsLinearRegression.cs (50)
121: base(Contracts.CheckRef(env, nameof(env)).Register(LoadNameValue), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), 520Contracts.Assert(ioffset == xtx.Length); 567Contracts.CheckParam((long)n * (n + 1) / 2 <= ap.Length, nameof(ap), "vector had insufficient length"); 575throw Contracts.ExceptParam(nameof(layout)); 577throw Contracts.ExceptParam(nameof(uplo)); 579throw Contracts.ExceptParam(nameof(n)); 581throw Contracts.ExceptParam(nameof(ap)); 583throw Contracts.ExceptParam(nameof(ap), "Input matrix was not positive-definite. Try using a larger L2 regularization weight."); 606Contracts.CheckParam((long)n * (n + 1) / 2 <= ap.Length, nameof(ap), "vector had insufficient length"); 607Contracts.CheckParam((long)n * ldb <= b.Length, nameof(b), "vector had insufficient length"); 615throw Contracts.ExceptParam(nameof(layout)); 617throw Contracts.ExceptParam(nameof(uplo)); 619throw Contracts.ExceptParam(nameof(n)); 621throw Contracts.ExceptParam(nameof(nrhs)); 623throw Contracts.ExceptParam(nameof(ap)); 625throw Contracts.ExceptParam(nameof(b)); 627throw Contracts.ExceptParam(nameof(ldb)); 629throw Contracts.Except(); 649Contracts.CheckParam((long)n * (n + 1) / 2 <= ap.Length, nameof(ap), "vector had insufficient length"); 658throw Contracts.ExceptParam(nameof(layout)); 660throw Contracts.ExceptParam(nameof(uplo)); 662throw Contracts.ExceptParam(nameof(n)); 664throw Contracts.ExceptParam(nameof(ap)); 666throw Contracts.Except(); 677Contracts.CheckValue(env, nameof(env)); 774Contracts.AssertValueOrNull(standardErrors); 775Contracts.AssertValueOrNull(tValues); 776Contracts.AssertValueOrNull(pValues); 779Contracts.Assert(!Double.IsNaN(rSquaredAdjusted) || standardErrors == null); 781Contracts.Assert((standardErrors == null) == (tValues == null) && (tValues == null) == (pValues == null)); 782Contracts.Assert(0 <= rSquared && rSquared <= 1); 783Contracts.Assert(Double.IsNaN(rSquaredAdjusted) || (0 <= rSquaredAdjusted && rSquaredAdjusted <= 1)); 787Contracts.Assert(Utils.Size(standardErrors) == weights.Length + 1); 788Contracts.Assert(Utils.Size(tValues) == weights.Length + 1); 789Contracts.Assert(Utils.Size(pValues) == weights.Length + 1); 793Contracts.Assert(FloatUtils.IsFinite(standardErrors[i])); 794Contracts.Assert(FloatUtils.IsFinite(tValues[i])); 795Contracts.Assert(FloatUtils.IsFinite(pValues[i])); 862Contracts.Assert(0 <= RSquared && RSquared <= 1); 864Contracts.Assert(Double.IsNaN(RSquaredAdjusted) || (0 <= RSquaredAdjusted && RSquaredAdjusted <= 1)); 866Contracts.Assert(!Double.IsNaN(RSquaredAdjusted) || !HasStatistics); 870Contracts.Assert(_standardErrors == null && _tValues == null && _pValues == null); 873Contracts.Assert(Weight.Length + 1 == _standardErrors.Length); 874Contracts.Assert(Weight.Length + 1 == _tValues.Length); 875Contracts.Assert(Weight.Length + 1 == _pValues.Length); 883Contracts.CheckDecode(Math.Sign(param) == Math.Sign(tvalue)); 888Contracts.CheckDecode(0 <= p && p <= 1); 893Contracts.CheckValue(env, nameof(env)); 914Contracts.Assert(Weight.IsDense); 929Contracts.Assert(Weight.IsDense);
SymSgdClassificationTrainer.cs (2)
241: base(Contracts.CheckRef(env, nameof(env)).Register(LoadNameValue), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), 288Contracts.CheckValue(env, nameof(env));
VectorWhitening.cs (29)
96Contracts.AssertNonEmpty(str); 106Contracts.AssertValue(sb); 148: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(VectorWhiteningTransformer)), GetColumnPairs(columns)) 157: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(VectorWhiteningTransformer)), ctx) 187Contracts.CheckValue(env, nameof(env)); 711Contracts.Assert(count <= indices.Length); 775Contracts.CheckValue(Name, nameof(Name)); 777Contracts.CheckValue(InputColumnName, nameof(InputColumnName)); 779Contracts.CheckUserArg(Kind == WhiteningKind.PrincipalComponentAnalysis || Kind == WhiteningKind.ZeroPhaseComponentAnalysis, nameof(Kind)); 781Contracts.CheckUserArg(0 <= Epsilon && Epsilon < float.PositiveInfinity, nameof(Epsilon)); 783Contracts.CheckUserArg(MaximumNumberOfRows > 0, nameof(MaximumNumberOfRows)); 786Contracts.CheckUserArg(Rank >= 0, nameof(Rank)); 792Contracts.CheckValue(Name, nameof(Name)); 794Contracts.CheckValue(InputColumnName, nameof(InputColumnName)); 796Contracts.CheckUserArg(Kind == WhiteningKind.PrincipalComponentAnalysis || Kind == WhiteningKind.ZeroPhaseComponentAnalysis, nameof(item.Kind)); 798Contracts.CheckUserArg(0 <= Epsilon && Epsilon < float.PositiveInfinity, nameof(item.Eps)); 800Contracts.CheckUserArg(MaximumNumberOfRows > 0, nameof(item.MaxRows)); 803Contracts.CheckUserArg(Rank >= 0, nameof(item.PcaNum)); 808Contracts.AssertValue(ctx); 817Contracts.CheckDecode(Kind == WhiteningKind.PrincipalComponentAnalysis || Kind == WhiteningKind.ZeroPhaseComponentAnalysis); 819Contracts.CheckDecode(0 <= Epsilon && Epsilon < float.PositiveInfinity); 821Contracts.CheckDecode(MaximumNumberOfRows > 0); 824Contracts.CheckDecode(Rank >= 0); 829Contracts.AssertValue(ctx); 837Contracts.Assert(Kind == WhiteningKind.PrincipalComponentAnalysis || Kind == WhiteningKind.ZeroPhaseComponentAnalysis); 839Contracts.Assert(0 <= Epsilon && Epsilon < float.PositiveInfinity); 841Contracts.Assert(MaximumNumberOfRows > 0); 844Contracts.Assert(Rank >= 0); 856_host = Contracts.CheckRef(env, nameof(env)).Register(nameof(VectorWhiteningEstimator));
Microsoft.ML.OnnxConverter (31)
OnnxContextImpl.cs (2)
42Contracts.CheckValue(env, nameof(env)); 121Contracts.Assert(_variableNames.Contains(columnName));
OnnxNodeImpl.cs (1)
18Contracts.AssertValue(node);
OnnxUtils.cs (25)
24Contracts.CheckValue(typeProto, nameof(typeProto)); 53Contracts.CheckValue(value, nameof(value)); 54Contracts.CheckNonEmpty(name, nameof(name)); 66Contracts.CheckNonEmpty(key, nameof(key)); 91Contracts.CheckValue(value, nameof(value)); 101Contracts.CheckValue(value, nameof(value)); 119Contracts.CheckValue(value, nameof(value)); 137Contracts.CheckValue(value, nameof(value)); 155Contracts.CheckValue(value, nameof(value)); 167Contracts.CheckNonEmpty(opType, nameof(opType)); 168Contracts.CheckValue(inputs, nameof(inputs)); 169Contracts.CheckValue(outputs, nameof(outputs)); 170Contracts.CheckNonEmpty(name, nameof(name)); 256Contracts.Check(false, msg); 291Contracts.CheckValue(nodes, nameof(nodes)); 292Contracts.CheckValue(inputs, nameof(inputs)); 293Contracts.CheckValue(outputs, nameof(outputs)); 294Contracts.CheckValue(intermediateValues, nameof(intermediateValues)); 295Contracts.CheckValue(initializers, nameof(initializers)); 296Contracts.CheckNonEmpty(producerName, nameof(producerName)); 297Contracts.CheckNonEmpty(name, nameof(name)); 298Contracts.CheckNonEmpty(domain, nameof(domain)); 299Contracts.CheckNonEmpty(producerVersion, nameof(producerVersion)); 342Contracts.CheckValue(type, nameof(type)); 343Contracts.CheckNonEmpty(colName, nameof(colName));
SaveOnnxCommand.cs (3)
375Contracts.CheckUserArg(_loadPredictor != true, 382Contracts.CheckUserArg(_loadPredictor != true, 417Contracts.Assert(loader != null);
Microsoft.ML.OnnxTransformer (18)
OnnxTransform.cs (9)
162Contracts.CheckValue(env, nameof(env)); 236base(Contracts.CheckRef(env, nameof(env)).Register(nameof(OnnxTransformer))) 507base(Contracts.CheckRef(parent, nameof(parent)).Host.Register(nameof(Mapper)), inputSchema, parent) 561throw Contracts.Except($"Input shape mismatch: Input '{_parent.Inputs[i]}' has shape {String.Join(",", inputShape)}, but input data is of length {typeValueCount}."); 643Contracts.Assert(input.Schema == InputSchema); 698Contracts.Assert(outputCache.OutputOnnxValues.Count > 0); 802Contracts.AssertValue(type); 825Contracts.AssertValue(type); 1020: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(OnnxTransformer)), transformer)
OnnxTypeParser.cs (5)
69throw Contracts.Except("Unsupported ONNX scalar type: " + dataType.ToString()); 157throw Contracts.Except("Unsupported ONNX scalar type: " + dataType.ToString()); 174throw Contracts.ExceptParamValue(dim.DimValue, nameof(dim), $"Dimension {dim} in ONNX tensor cannot exceed the maximum of 32-bit signed integer."); 258throw Contracts.ExceptParamValue(typeProto, nameof(typeProto), $"Unsupported ONNX variable type {typeProto}"); 382throw Contracts.ExceptParamValue(typeProto, nameof(typeProto), $"Unsupported ONNX variable type {typeProto}");
OnnxUtils.cs (4)
84throw Contracts.ExceptParamValue(name, nameof(name), $"Input tensor, {name}, does not exist in the ONNX model. " + 95throw Contracts.ExceptParamValue(name, nameof(name), $"Ouput tensor, {name}, does not exist in the ONNX model. " + 318throw Contracts.ExceptParamValue(shapeDictionary[name], nameof(shapeDictionary), 582throw Contracts.ExceptNotSupp("Onnx type not supported", type);
Microsoft.ML.Parquet (44)
ParquetLoader.cs (12)
67Contracts.AssertNonEmpty(name); 68Contracts.AssertValue(colType); 69Contracts.AssertValue(dataField); 134Contracts.AssertValue(host, nameof(host)); 178Contracts.AssertValue(host); 241Contracts.CheckValue(env, nameof(env)); 316Contracts.AssertValue(ectx); 317Contracts.AssertValue(cols); 373Contracts.CheckValue(files, nameof(files)); 374Contracts.CheckParam(files.Count == 1, nameof(files), "Parquet loader must be created with one file"); 380Contracts.CheckNonEmpty(filename, nameof(filename)); 408Contracts.CheckValue(ctx, nameof(ctx));
PartitionedFileLoader.cs (15)
97Contracts.AssertNonEmpty(str); 144Contracts.AssertValue(sb); 176Contracts.CheckValue(env, nameof(env)); 212Contracts.AssertValue(host); 245Contracts.CheckValue(env, nameof(env)); 258Contracts.CheckValue(ctx, nameof(ctx)); 317Contracts.AssertValue(cols); 318Contracts.AssertValue(subLoader); 344Contracts.CheckValue(loader, nameof(loader)); 355Contracts.CheckValue(loaderBytes, nameof(loaderBytes)); 356Contracts.CheckValue(files, nameof(files)); 391Contracts.AssertValue(parent); 392Contracts.AssertValue(files); 724Contracts.CheckNonWhiteSpace(path, nameof(path)); 750Contracts.CheckNonEmpty(basepath, nameof(basepath));
PartitionedPathParser.cs (12)
120Contracts.AssertValue(host); 143Contracts.CheckValue(ctx, nameof(ctx)); 153Contracts.CheckValue(ctx, nameof(ctx)); 173Contracts.AssertNonEmpty(path); 181throw Contracts.Except($"Column definition {col} is outside the bounds of path {path}."); 190Contracts.AssertNonEmpty(path); 233Contracts.AssertValue(host); 256Contracts.CheckValue(ctx, nameof(ctx)); 266Contracts.CheckValue(ctx, nameof(ctx)); 287throw Contracts.Except($"Failed to parse names from path {path}. Expected directory names with the format 'Name=Value'."); 308throw Contracts.Except($"Failed to parse names from path {path}. Expected directory names with the format 'Name=Value'."); 313throw Contracts.Except($"The extracted value count of {values.Count} does not match the expected Column count of {_columns.Length} for path {path}");
PartitionedPathUtils.cs (5)
23Contracts.AssertNonEmpty(basepath); 24Contracts.AssertNonEmpty(path); 31throw Contracts.ExceptParam(nameof(basepath), "Paths cannot be made relative as they are of different schemes."); 46throw Contracts.Except(e, "Paths could not be made relative."); 50throw Contracts.Except(e, "Paths could not be made relative.");
Microsoft.ML.PCA (31)
PCACatalog.cs (2)
75Contracts.CheckValue(catalog, nameof(catalog)); 97Contracts.CheckValue(catalog, nameof(catalog));
PcaTrainer.cs (5)
161: base(Contracts.CheckRef(env, nameof(env)).Register(LoadNameValue), TrainerUtils.MakeR4VecFeature(featureColumnName), default, TrainerUtils.MakeR4ScalarWeightColumn(exampleWeightColumnName)) 300Contracts.AssertValue(host, "host"); 333Contracts.Check(n > 0, "Empty training data"); 399Contracts.CheckValue(env, nameof(env)); 549Contracts.CheckValue(env, nameof(env));
PcaTransformer.cs (24)
78Contracts.AssertNonEmpty(str); 88Contracts.AssertValue(sb); 112Contracts.CheckParam(0 < Rank && Rank <= Dimension, nameof(Rank), "Rank must be positive, and at most the dimension of untransformed data"); 117Contracts.AssertValue(ctx); 129Contracts.CheckDecode(0 < Rank && Rank <= Dimension); 135Contracts.CheckDecode(FloatUtils.IsFinite(Eigenvectors[i])); 139Contracts.CheckDecode(MeanProjected == null || (MeanProjected.Length == Rank && FloatUtils.IsFinite(MeanProjected))); 144Contracts.AssertValue(ctx); 154Contracts.Assert(0 < Rank && Rank <= Dimension); 159Contracts.Assert(FloatUtils.IsFinite(Eigenvectors[i])); 162Contracts.Assert(MeanProjected == null || (MeanProjected.Length == Rank && FloatUtils.IsFinite(MeanProjected))); 168Contracts.AssertValue(Eigenvectors); 205: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(PrincipalComponentAnalysisTransformer)), GetColumnPairs(columns)) 250Contracts.CheckValue(env, nameof(env)); 268Contracts.CheckValue(env, nameof(env)); 296Contracts.CheckValue(columns, nameof(columns)); 395Contracts.Assert(omega[i].Length == y[i].Length); 533throw Contracts.Except("Weight column '{0}' does not exist.", weightColumn); 534Contracts.CheckParam(schema[weightIndex].Type == NumberDataViewType.Single, nameof(weightColumn)); 571Contracts.AssertValue(input); 572Contracts.Assert(0 <= iinfo && iinfo < _numColumns); 768Contracts.CheckParam(Oversampling >= 0, nameof(Oversampling), "Oversampling must be non-negative."); 769Contracts.CheckParam(Rank > 0, nameof(Rank), "Rank must be positive."); 801Contracts.CheckValue(env, nameof(env));
Microsoft.ML.Predictor.Tests (4)
CompareBaselines.cs (2)
81Contracts.Assert(!names2[nameLower]); 104Contracts.Assert(!names2[nameLower]);
TestTransposer.cs (2)
85Contracts.Assert(vals.Length == expectedVals.Length); 187Contracts.Assert(result);
Microsoft.ML.Recommender (17)
MatrixFactorizationPredictor.cs (7)
94Contracts.CheckValue(env, nameof(env)); 115Contracts.CheckValue(env, nameof(env)); 157Contracts.CheckValue(env, nameof(env)); 315Contracts.AssertValue(env); 337Contracts.AssertValue(parent); 447: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(MatrixFactorizationPredictionTransformer)), model, trainSchema) 483: base(Contracts.CheckRef(host, nameof(host)).Register(nameof(MatrixFactorizationPredictionTransformer)), ctx)
MatrixFactorizationTrainer.cs (3)
347Contracts.CheckValue(env, nameof(env)); 396Contracts.CheckValue(env, nameof(env)); 591Contracts.Assert(success);
RecommenderUtils.cs (7)
24Contracts.AssertValue(data); 50Contracts.AssertValue(data); 51Contracts.AssertValue(role.Value); 58throw Contracts.ExceptDecode(format2, role.Value, kindCount); 59throw Contracts.Except(format2, role.Value, kindCount); 70throw Contracts.ExceptDecode(format, col.Name, role.Value, col.Type); 71throw Contracts.Except(format, col.Name, role.Value, col.Type);
Microsoft.ML.ResultProcessor (5)
ResultProcessor.cs (5)
465Contracts.AssertNonEmpty(testArgs.InputModelFile); 501Contracts.AssertValue(specificCVArgs); 521Contracts.AssertValue(trainer); 523Contracts.AssertValue(commandLineTrainer, "ResultProcessor can only work with ICommandLineComponentFactory."); 735Contracts.AssertValue(lines);
Microsoft.ML.StandardTrainers (389)
FactorizationMachine\FactorizationMachineCatalog.cs (3)
38Contracts.CheckValue(catalog, nameof(catalog)); 61Contracts.CheckValue(catalog, nameof(catalog)); 80Contracts.CheckValue(catalog, nameof(catalog));
FactorizationMachine\FactorizationMachineTrainer.cs (4)
224Contracts.CheckValue(env, nameof(env)); 256Contracts.CheckValue(env, nameof(env)); 576Contracts.CheckValue(env, nameof(env)); 657Contracts.Assert(success);
FactorizationMachine\FieldAwareFactorizationMachineModelParameters.cs (3)
180Contracts.CheckValue(env, nameof(env)); 306: base(Contracts.CheckRef(host, nameof(host)).Register(nameof(FieldAwareFactorizationMachinePredictionTransformer)), model, trainSchema) 333: base(Contracts.CheckRef(host, nameof(host)).Register(nameof(FieldAwareFactorizationMachinePredictionTransformer)), ctx)
FactorizationMachine\FieldAwareFactorizationMachineUtils.cs (6)
76Contracts.AssertValue(env); 77Contracts.AssertValue(schema); 78Contracts.CheckParam(outputSchema.Count == 2, nameof(outputSchema)); 79Contracts.CheckParam(outputSchema[0].Type is NumberDataViewType, nameof(outputSchema)); 80Contracts.CheckParam(outputSchema[1].Type is NumberDataViewType, nameof(outputSchema)); 81Contracts.AssertValue(pred);
LdSvm\LdSvmModelParameters.cs (1)
150Contracts.CheckValue(env, nameof(env));
LdSvm\LdSvmTrainer.cs (2)
165: base(Contracts.CheckRef(env, nameof(env)).Register(LoadNameValue), 671Contracts.CheckValue(env, nameof(env));
Optimizer\L1Optimizer.cs (2)
46Contracts.AssertValue(ch); 79Contracts.AssertValue(ch);
Optimizer\LineSearch.cs (2)
168Contracts.CheckParam(initDeriv < 0, nameof(initDeriv), "Cannot search in direction of ascent!"); 426Contracts.Check(initDeriv < 0, "Cannot search in direction of ascent!");
Optimizer\OptimizationMonitor.cs (1)
56Contracts.CheckParam(gradientCheckInterval > 0, nameof(gradientCheckInterval),
Optimizer\Optimizer.cs (3)
67Contracts.CheckValue(env, nameof(env)); 199Contracts.AssertValue(ch); 382Contracts.AssertValue(ch);
Optimizer\SgdOptimizer.cs (12)
34Contracts.Check(value > 0); 49Contracts.Check(0 <= value && value < 1); 64Contracts.Check(value >= 0); 106Contracts.Check(value >= 0); 168Contracts.Check(FloatUtils.IsFinite(initial.GetValues()), "The initial vector contains NaNs or infinite values."); 198throw Contracts.Except(); 257Contracts.Check(value >= 0); 365Contracts.Check(FloatUtils.IsFinite(initial.GetValues()), "The initial vector contains NaNs or infinite values."); 398Contracts.Assert(x.Length == xprev.Length, "Vectors must have the same dimensionality."); 399Contracts.Assert(FloatUtils.IsFinite(xprev.GetValues())); 426Contracts.Assert(i == j); 449Contracts.Assert(j == i);
Standard\LinearModelParameters.cs (16)
73Contracts.CheckParam(0 <= index && index < Count, nameof(index), "Out of range"); 82Contracts.AssertValue(pred); 278throw Contracts.Except("Input is of length {0} does not match expected length of weights {1}", features.Length, Weight.Length); 290Contracts.AssertValue(_weightsDenseLock); 311Contracts.Check(typeof(TIn) == typeof(VBuffer<float>)); 312Contracts.Check(typeof(TOut) == typeof(float)); 318throw Contracts.Except("Input is of length {0}, but predictor expected length {1}", src.Length, Weight.Length); 331Contracts.Check(type == models[0].GetType(), "Submodel for parameter mixer has the wrong type"); 341Contracts.Check(type == m.GetType(), "Submodel for parameter mixer has the wrong type"); 404Contracts.Check(typeof(TSrc) == typeof(VBuffer<float>)); 405Contracts.Check(typeof(TDstContributions) == typeof(VBuffer<float>)); 453Contracts.AssertValueOrNull(stats); 483Contracts.CheckValue(env, nameof(env)); 505Contracts.AssertValueOrNull(Statistics); 646Contracts.CheckValue(env, nameof(env)); 732Contracts.CheckValue(env, nameof(env));
Standard\LinearPredictorUtils.cs (3)
34Contracts.CheckValue(writer, nameof(writer)); 35Contracts.CheckValueOrNull(schema); 200Contracts.Assert(weightValue.Value is float);
Standard\LogisticRegression\LbfgsPredictorBase.cs (26)
232: base(Contracts.CheckRef(env, nameof(env)).Register(RegisterName), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), 432Contracts.CheckValue(context, nameof(context)); 445throw Contracts.ExceptParam(nameof(data), 729Contracts.Assert(vec.Length == BiasCount + WeightCount); 745Contracts.Assert((_numChunks == 0) != (_data == null)); 746Contracts.Assert((_cursorFactory == null) == (_data == null)); 747Contracts.Assert(x.Length == BiasCount + WeightCount); 748Contracts.Assert(gradient.Length == BiasCount + WeightCount); 750Contracts.AssertValueOrNull(progress); 774Contracts.Assert(xDense.IsDense); 804Contracts.Assert(_data == null); 805Contracts.Assert(_cursorFactory == null); 806Contracts.Assert(_numChunks > 0); 807Contracts.Assert(Utils.Size(_ranges) == _numChunks + 1); 808Contracts.Assert(Utils.Size(_localLosses) == _numChunks); 809Contracts.Assert(Utils.Size(_localGradients) + 1 == _numChunks); 810Contracts.AssertValueOrNull(pch); 836Contracts.Assert(0 <= ichk && ichk < _numChunks); 837Contracts.AssertValueOrNull(pch); 862Contracts.AssertValue(cursorFactory); 890Contracts.AssertValue(biases); 891Contracts.AssertValue(weights); 900Contracts.Check(i < BiasCount, classError); 903Contracts.Check(i == BiasCount, classError); 908Contracts.Check(i < initWeights.Length, featError); 911Contracts.Check(i == initWeights.Length, featError);
Standard\LogisticRegression\LogisticRegression.cs (21)
165Contracts.AssertValue(data); 207Contracts.Check(!float.IsNaN(datumLoss), "Unexpected NaN"); 214Contracts.Assert(editor.Values.Length >= BiasCount && (grad.IsDense || editor.Indices[BiasCount - 1] == BiasCount - 1)); 222Contracts.AssertValue(ch); 223Contracts.AssertValue(cursorFactory); 224Contracts.Assert(NumGoodRows > 0); 225Contracts.Assert(WeightSum > 0); 226Contracts.Assert(BiasCount == 1); 227Contracts.Assert(loss >= 0); 228Contracts.Assert(numParams >= BiasCount); 229Contracts.Assert(CurrentWeights.IsDense); 259Contracts.Assert(0 <= priorPosRate && priorPosRate <= 1); 302Contracts.Assert(j == numParams); 338Contracts.Assert(i == hessian.Length - 1); 366Contracts.Assert(0 <= wi && wi < cursor.Features.Length); 374Contracts.Assert(0 <= wj && wj < cursor.Features.Length); 390Contracts.Assert(0 < wi && wi <= cursor.Features.Length); 403Contracts.Assert(0 < wj && wj <= cursor.Features.Length); 439Contracts.AssertValue(srcPredictor); 442Contracts.AssertValue(pred); 468Contracts.CheckValue(env, nameof(env));
Standard\LogisticRegression\MulticlassLogisticRegression.cs (45)
171Contracts.AssertValue(data); 225Contracts.Assert(!string.IsNullOrEmpty(_labelNames[i])); 228Contracts.Assert(_labelNames == null || _labelNames.Length == _numClasses); 261Contracts.Assert(0 <= lab && lab < _numClasses); 272Contracts.Assert(editor.Values.Length >= BiasCount && (grad.IsDense || editor.Indices[BiasCount - 1] == BiasCount - 1)); 276Contracts.Check(FloatUtils.IsFinite(datumLoss), "Data contain bad values."); 283Contracts.AssertValue(pred); 284Contracts.Assert(pred.InputType.GetVectorSize() > 0); 288throw Contracts.Except("The input training data must have the same features used to train the input predictor."); 296throw Contracts.Except("Cannot create a multiclass predictor with {0} classes", _numClasses); 310Contracts.AssertValue(ch); 311Contracts.AssertValue(cursorFactory); 312Contracts.Assert(NumGoodRows > 0); 313Contracts.Assert(WeightSum > 0); 314Contracts.Assert(BiasCount == _numClasses); 315Contracts.Assert(loss >= 0); 316Contracts.Assert(numParams >= BiasCount); 317Contracts.Assert(CurrentWeights.IsDense); 347Contracts.Assert(_prior[iLabel] >= 0); 365Contracts.Assert(0 <= iLabel && iLabel < _numClasses); 372Contracts.Assert(success); 399Contracts.CheckValue(env, nameof(env)); 459Contracts.Assert(weights.Length == numClasses + numClasses * numFeatures); 467Contracts.Assert(weights.Length == NumberOfClasses + NumberOfClasses * NumberOfFeatures); 481Contracts.Assert(labelNames == null || labelNames.Length == numClasses); 484Contracts.AssertValueOrNull(stats); 503Contracts.CheckValue(weights, nameof(weights)); 504Contracts.CheckValue(bias, nameof(bias)); 505Contracts.CheckParam(numClasses >= 2, nameof(numClasses), "Must be at least 2."); 507Contracts.CheckParam(numFeatures >= 1, nameof(numFeatures), "Must be positive."); 509Contracts.Check(Utils.Size(weights) == NumberOfClasses); 510Contracts.Check(Utils.Size(bias) == NumberOfClasses); 515Contracts.Assert(weights[iClass].Length == NumberOfFeatures); 526Contracts.Assert(labelNames == null || labelNames.Length == numClasses); 529Contracts.AssertValueOrNull(stats); 745Contracts.AssertValueOrNull(_labelNames); 749Contracts.AssertValueOrNull(Statistics); 1047Contracts.Assert(Weights.Length == Biases.Length); 1061Contracts.Assert(0 <= classNumber && classNumber < NumberOfClasses); 1067Contracts.AssertValue(ctx); 1068Contracts.AssertValue(reader); 1084Contracts.AssertValue(ctx); 1085Contracts.AssertValue(writer); 1086Contracts.Assert(Utils.Size(_labelNames) == NumberOfClasses); 1173Contracts.CheckValue(env, nameof(env));
Standard\ModelStatistics.cs (10)
94Contracts.CheckValue(env, nameof(env)); 108Contracts.CheckValue(env, nameof(env)); 130Contracts.AssertValue(Env); 156Contracts.AssertValue(Env); 172Contracts.AssertValue(Env); 344Contracts.Assert(stdError == _coeffStdError.GetItemOrDefault(0)); 360Contracts.Assert(_coeffStdError.Length == _weights.Length + 1); 377Contracts.Assert(0 <= wi && wi < _weights.Length); 406Contracts.AssertValue(Env); 492Contracts.AssertValue(Env);
Standard\MulticlassClassification\MetaMulticlassTrainer.cs (2)
66Host = Contracts.CheckRef(env, nameof(env)).Register(name); 169Contracts.Assert(success);
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (5)
97: base(Contracts.CheckRef(env, nameof(env)).Register(LoadName), TrainerUtils.MakeR4VecFeature(featureColumn), 108: base(Contracts.CheckRef(env, nameof(env)).Register(LoadName), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), 117Contracts.Assert(success); 210Contracts.CheckValue(env, nameof(env)); 357Contracts.CheckValue(env, nameof(env));
Standard\MulticlassClassification\OneVersusAllTrainer.cs (28)
351Contracts.CheckValue(host, nameof(host)); 400Contracts.CheckValue(env, nameof(env)); 515Contracts.AssertValueOrNull(mapper); 516Contracts.AssertValueOrNull(inputType); 553Contracts.AssertValue(pred); 573Contracts.Assert(outputNames.Length >= 2); 605Contracts.CheckNonEmpty(predictors, nameof(predictors)); 612Contracts.Check(IsValid(vm, ref inputType), "Predictor doesn't implement the expected interface"); 616Contracts.AssertValue(inputType); 633Contracts.Check(src.Length == inputSize); 646Contracts.CheckValue(ctx, nameof(ctx)); 647Contracts.CheckValue(input, nameof(input)); 648Contracts.Assert(CanSavePfa); 654Contracts.Assert(pred.CanSavePfa); 689Contracts.Check(Utils.Size(predictors) > 0); 696Contracts.Check(IsValid(vm, ref inputType), "Predictor doesn't implement the expected interface"); 700Contracts.AssertValue(inputType); 726Contracts.Check(src.Length == inputSize); 773Contracts.CheckValue(ctx, nameof(ctx)); 774Contracts.CheckValue(input, nameof(input)); 775Contracts.Assert(CanSavePfa); 781Contracts.Assert(pred.CanSavePfa); 794Contracts.Assert(outputNames.Length >= 2); 854Contracts.CheckNonEmpty(predictors, nameof(predictors)); 861Contracts.Check(IsValid(vm, ref inputType), "Predictor doesn't implement the expected interface"); 865Contracts.AssertValue(inputType); 882Contracts.Check(src.Length == inputSize); 916Contracts.Assert(outputNames.Length >= 2);
Standard\MulticlassClassification\PairwiseCouplingTrainer.cs (2)
347Contracts.CheckValue(env, nameof(env)); 385Contracts.Assert(output.Length >= _numClasses);
Standard\Online\AveragedLinear.cs (7)
184Contracts.Assert(Averaged); 309Contracts.CheckUserArg(options.LearningRate > 0, nameof(options.LearningRate), UserErrorPositive); 310Contracts.CheckUserArg(!options.ResetWeightsAfterXExamples.HasValue || options.ResetWeightsAfterXExamples > 0, nameof(options.ResetWeightsAfterXExamples), UserErrorPositive); 313Contracts.CheckUserArg(0 <= options.L2Regularization && options.L2Regularization < 0.5, nameof(options.L2Regularization), "must be in range [0, 0.5)"); 314Contracts.CheckUserArg(options.RecencyGain >= 0, nameof(options.RecencyGain), UserErrorNonNegative); 315Contracts.CheckUserArg(options.AveragedTolerance >= 0, nameof(options.AveragedTolerance), UserErrorNonNegative); 317Contracts.Check(!options.LazyUpdate || !options.RecencyGainMultiplicative && options.RecencyGain == 0, "Cannot have both recency gain and lazy updates.");
Standard\Online\AveragedPerceptron.cs (3)
131Contracts.Assert(WeightsScale == 1); 208Contracts.AssertValue(data); 226Contracts.CheckValue(env, nameof(env));
Standard\Online\LinearSvm.cs (8)
206Contracts.Assert(_weightsUpdate.GetValues().Length == 0); 225Contracts.Assert(_batch > 0); 236Contracts.Assert(!_noBias || Bias == 0); 262Contracts.Assert(WeightsScale == 1); 297Contracts.CheckUserArg(options.Lambda > 0, nameof(options.Lambda), UserErrorPositive); 298Contracts.CheckUserArg(options.BatchSize > 0, nameof(options.BatchSize), UserErrorPositive); 316Contracts.AssertValue(data); 326Contracts.CheckValue(env, nameof(env));
Standard\Online\OnlineGradientDescent.cs (2)
109Contracts.Assert(WeightsScale == 1); 192Contracts.CheckValue(env, nameof(env));
Standard\Online\OnlineLinear.cs (6)
125Contracts.CheckValue(ch, nameof(ch)); 216Contracts.Check(NumIterExamples > 0, NoTrainingInstancesMessage); 262: base(Contracts.CheckRef(env, nameof(env)).Register(name), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), label, TrainerUtils.MakeR4ScalarWeightColumn(options.InitialWeights)) 264Contracts.CheckValue(options, nameof(options)); 265Contracts.CheckUserArg(options.NumberOfIterations > 0, nameof(options.NumberOfIterations), UserErrorPositive); 266Contracts.CheckUserArg(options.InitialWeightsDiameter >= 0, nameof(options.InitialWeightsDiameter), UserErrorNonNegative);
Standard\PoissonRegression\PoissonRegression.cs (4)
115Contracts.AssertValue(data); 146throw Contracts.Except("Poisson regression must regress to a non-negative label, but label {0} encountered", label); 179Contracts.Assert(editor.Values.Length >= BiasCount && (grad.IsDense || editor.Indices[BiasCount - 1] == BiasCount - 1)); 214Contracts.CheckValue(env, nameof(env));
Standard\SdcaBinary.cs (75)
64: base(Contracts.CheckRef(env, nameof(env)).Register(RegisterName), TrainerUtils.MakeR4VecFeature(featureColumn), 242Contracts.AssertValue(env); 308: base(Contracts.CheckRef(env, nameof(env)).Register(RegisterName), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName), label, weight) 324Contracts.Assert(predictor == null, "SDCA based trainers don't support continuous training."); 325Contracts.Assert(weightSetCount >= 1); 396Contracts.Assert(id.High == 0); 404Contracts.Assert(count <= maxTrainingExamples); 407Contracts.Assert((long)idLoMax < maxTrainingExamples); 445Contracts.Assert(idToIdx.Count == count); 456Contracts.Assert(SdcaTrainerOptions.MaximumNumberOfIterations.HasValue); 460Contracts.Assert(SdcaTrainerOptions.L2Regularization.HasValue); 504Contracts.Assert(!needLookup); 512Contracts.Assert(invariantsLength <= Utils.ArrayMaxSize); 521Contracts.Assert(dualsLength <= MaxDualTableSize); 528Contracts.Assert(needLookup); 533Contracts.Assert(count <= Utils.ArrayMaxSize); 538Contracts.Assert(dualsLength <= MaxDualTableSize); 545Contracts.Assert(Utils.Size(invariants) > 0); 549Contracts.AssertValue(duals); 550Contracts.AssertValueOrNull(invariants); 568Contracts.Assert((idToIdx == null && ((long)idLoMax + 1) * weightSetCount <= Utils.ArrayMaxSize) || (idToIdx != null && count * weightSetCount <= Utils.ArrayMaxSize)); 580Contracts.Assert(0 <= longIdx && longIdx < invariants.Length, $"longIdx={longIdx}, invariants.Length={invariants.Length}"); 686Contracts.AssertValue(ch); 687Contracts.Assert(count > 0); 688Contracts.Assert(numThreads > 0); 700Contracts.AssertValue(ch); 701Contracts.Assert(maxIterations > 0); 702Contracts.Assert(rowCount > 0); 703Contracts.Assert(numThreads > 0); 707Contracts.Assert(expectedIterations > 0); 719Contracts.Assert(numFeatures > 0); 794Contracts.AssertValueOrNull(progress); 795Contracts.Assert(SdcaTrainerOptions.L1Regularization.HasValue); 796Contracts.AssertValueOrNull(idToIdx); 797Contracts.AssertValueOrNull(invariants); 798Contracts.AssertValueOrNull(featureNormSquared); 823Contracts.Assert(featureNormSquared == null); 962Contracts.AssertValueOrNull(idToIdx); 963Contracts.Assert(Utils.Size(metrics) == 6); 992Contracts.Assert(SdcaTrainerOptions.L2Regularization.HasValue); 993Contracts.Assert(SdcaTrainerOptions.L1Regularization.HasValue); 1062Contracts.Assert(length <= Utils.ArrayMaxSize); 1089Contracts.Assert(length <= 1L << 50); 1112Contracts.AssertValueOrNull(idToIdx); 1118Contracts.Assert(id.High == 0); 1119Contracts.Assert((long)id.Low < maxTrainingExamples); 1129Contracts.Assert(found); 1130Contracts.Assert(0 <= idx && idx < idToIdx.Count); 1143Contracts.AssertValueOrNull(idToIdx); 1149Contracts.Assert(id.High == 0); 1150Contracts.Assert((long)id.Low < maxTrainingExamples); 1161Contracts.Assert(found); 1162Contracts.Assert(0 <= idx && idx < idToIdx.Count); 1163Contracts.Assert(idx == row); 1217Contracts.Assert(size >= 0); 1260Contracts.Assert(0 <= iit && iit < _rgit.Length); 1264Contracts.Assert(it < _count); 1271Contracts.Assert(it == -1); 1282Contracts.Assert(0 <= iit && iit < _rgit.Length); 1286Contracts.Assert(_count == _entries.Length); 1290Contracts.Assert(_count < _entries.Length); 1308Contracts.Assert(size >= _rgit.Length); 1337Contracts.AssertValue(_rgit); 1338Contracts.Assert(_rgit.Length > 0); 1339Contracts.Assert(0 <= _count && _count <= _entries.Length); 1343Contracts.Assert(_rgit.Length >= _count || _rgit.Length == HashHelpers.MaxPrime); 1401Contracts.Assert(0 <= min && min < MaxPrime); 1410Contracts.Assert(false); 1917Contracts.CheckValue(env, nameof(env)); 2021Contracts.AssertValue(data); 2022Contracts.Assert(weightSetCount == 1); 2023Contracts.AssertValueOrNull(predictor); 2024Contracts.Assert(data.Schema.Feature.HasValue); 2469Contracts.CheckValue(env, nameof(env)); 2493Contracts.CheckValue(env, nameof(env));
Standard\SdcaMulticlass.cs (22)
162Contracts.Assert(success); 178Contracts.AssertValueOrNull(progress); 179Contracts.Assert(SdcaTrainerOptions.L1Regularization.HasValue); 180Contracts.AssertValueOrNull(idToIdx); 181Contracts.AssertValueOrNull(invariants); 182Contracts.AssertValueOrNull(featureNormSquared); 184Contracts.Assert(Utils.Size(biasReg) == numClasses); 185Contracts.Assert(Utils.Size(biasUnreg) == numClasses); 213Contracts.AssertValue(featureNormSquared); 357Contracts.AssertValue(weights); 358Contracts.AssertValue(duals); 360Contracts.Assert(duals.Length >= numClasses * count); 361Contracts.AssertValueOrNull(idToIdx); 362Contracts.Assert(Utils.Size(weights) == numClasses); 363Contracts.Assert(Utils.Size(biasReg) == numClasses); 364Contracts.Assert(Utils.Size(biasUnreg) == numClasses); 365Contracts.Assert(Utils.Size(metrics) == 6); 398Contracts.Assert(dualIndex == iClass + idx * numClasses); 411Contracts.Assert(SdcaTrainerOptions.L2Regularization.HasValue); 412Contracts.Assert(SdcaTrainerOptions.L1Regularization.HasValue); 474Contracts.Assert(0 < length && length <= Utils.ArrayMaxSize); 677Contracts.CheckValue(env, nameof(env));
Standard\SdcaRegression.cs (5)
176Contracts.AssertValue(ch); 177Contracts.Assert(maxIterations > 0); 178Contracts.Assert(rowCount > 0); 179Contracts.Assert(numThreads > 0); 216Contracts.CheckValue(env, nameof(env));
Standard\Simple\SimpleTrainers.cs (15)
103Contracts.CheckValue(env, nameof(env)); 126Contracts.Check(typeof(TIn) == typeof(VBuffer<float>)); 127Contracts.Check(typeof(TOut) == typeof(float)); 135Contracts.Check(typeof(TIn) == typeof(VBuffer<float>)); 136Contracts.Check(typeof(TOut) == typeof(float)); 137Contracts.Check(typeof(TDist) == typeof(float)); 221Contracts.CheckValue(env, nameof(env)); 231Contracts.CheckValue(env, nameof(env)); 385Contracts.CheckValue(env, nameof(env)); 399Contracts.Assert(!float.IsNaN(_prob)); 447Contracts.Check(typeof(TIn) == typeof(VBuffer<float>)); 448Contracts.Check(typeof(TOut) == typeof(float)); 456Contracts.Check(typeof(TIn) == typeof(VBuffer<float>)); 457Contracts.Check(typeof(TOut) == typeof(float)); 458Contracts.Check(typeof(TDist) == typeof(float));
StandardTrainersCatalog.cs (45)
49Contracts.CheckValue(catalog, nameof(catalog)); 71Contracts.CheckValue(catalog, nameof(catalog)); 72Contracts.CheckValue(options, nameof(options)); 106Contracts.CheckValue(catalog, nameof(catalog)); 128Contracts.CheckValue(catalog, nameof(catalog)); 129Contracts.CheckValue(options, nameof(options)); 161Contracts.CheckValue(catalog, nameof(catalog)); 180Contracts.CheckValue(catalog, nameof(catalog)); 181Contracts.CheckValue(options, nameof(options)); 212Contracts.CheckValue(catalog, nameof(catalog)); 232Contracts.CheckValue(catalog, nameof(catalog)); 233Contracts.CheckValue(options, nameof(options)); 266Contracts.CheckValue(catalog, nameof(catalog)); 286Contracts.CheckValue(catalog, nameof(catalog)); 287Contracts.CheckValue(options, nameof(options)); 317Contracts.CheckValue(catalog, nameof(catalog)); 336Contracts.CheckValue(catalog, nameof(catalog)); 337Contracts.CheckValue(options, nameof(options)); 369Contracts.CheckValue(catalog, nameof(catalog)); 388Contracts.CheckValue(catalog, nameof(catalog)); 389Contracts.CheckValue(options, nameof(options)); 426Contracts.CheckValue(catalog, nameof(catalog)); 447Contracts.CheckValue(catalog, nameof(catalog)); 448Contracts.CheckValue(options, nameof(options)); 496Contracts.CheckValue(catalog, nameof(catalog)); 517Contracts.CheckValue(catalog, nameof(catalog)); 518Contracts.CheckValue(options, nameof(options)); 553Contracts.CheckValue(catalog, nameof(catalog)); 572Contracts.CheckValue(catalog, nameof(catalog)); 573Contracts.CheckValue(options, nameof(options)); 607Contracts.CheckValue(catalog, nameof(catalog)); 625Contracts.CheckValue(catalog, nameof(catalog)); 626Contracts.CheckValue(options, nameof(options)); 660Contracts.CheckValue(catalog, nameof(catalog)); 679Contracts.CheckValue(catalog, nameof(catalog)); 680Contracts.CheckValue(options, nameof(options)); 703Contracts.CheckValue(catalog, nameof(catalog)); 717Contracts.AssertValue(ectx); 761Contracts.CheckValue(catalog, nameof(catalog)); 800Contracts.CheckValue(catalog, nameof(catalog)); 829Contracts.CheckValue(catalog, nameof(catalog)); 848Contracts.CheckValue(catalog, nameof(catalog)); 849Contracts.CheckValue(options, nameof(options)); 874Contracts.CheckValue(catalog, nameof(catalog)); 918Contracts.CheckValue(catalog, nameof(catalog));
Microsoft.ML.Sweeper (52)
Algorithms\Grid.cs (6)
45Contracts.CheckValue(env, nameof(env)); 58Contracts.CheckValue(env, nameof(env)); 83Contracts.Assert(paramSet != null); 189Contracts.Assert(0 <= combination && combination < _nGridPoints); 194Contracts.Assert(sweepParameter.Count > 0); 195Contracts.Assert(div % sweepParameter.Count == 0);
Algorithms\KdoSweeper.cs (1)
90Contracts.CheckValue(env, nameof(env));
Algorithms\NelderMead.cs (14)
89Contracts.CheckValue(env, nameof(env)); 133Contracts.Check(run != null); 181Contracts.Assert(_pendingSweeps.Count == 1); 231Contracts.Assert(_pendingSweeps.Count == 1); 244Contracts.Assert(_pendingSweeps.Count == 1); 263Contracts.Assert(_pendingSweeps.Count == 1); 282Contracts.Assert(_pendingSweeps.Count + _pendingSweepsNotSubmitted.Count == _dim); 300Contracts.Assert(_centroid != null); 301Contracts.Assert(_simplexVertices.Count == _dim + 1); 338Contracts.Assert(point.Length == _sweepParameters.Count); 376throw Contracts.Except("previous runs do not contain results for expected runs"); 433Contracts.Assert(parameterSet.Count == _sweepParameters.Count); 438Contracts.AssertValue(parameterSet[_sweepParameters[i].Name]); 447Contracts.Assert(array.Length == _sweepParameters.Count);
Algorithms\SmacSweeper.cs (1)
70Contracts.CheckValue(env, nameof(env));
Algorithms\SweeperProbabilityUtils.cs (1)
214Contracts.Assert(array.Length == sweepParams.Length);
AsyncSweeper.cs (6)
34Contracts.CheckParam(id >= 0, nameof(id)); 35Contracts.CheckValueOrNull(param); 83Contracts.CheckValue(baseSweeper, nameof(baseSweeper)); 84Contracts.CheckParam(!(baseSweeper is NelderMeadSweeper), nameof(baseSweeper), "baseSweeper cannot be Nelder-Mead"); 103Contracts.CheckParam(0 <= id && id < _numGenerated, nameof(id), "Invalid run id"); 118throw Contracts.Except("Calling Propose after the sweeper is disposed");
ConfigRunner.cs (3)
68Contracts.AssertValue(env); 194Contracts.CheckParam(options.NumThreads == null || options.NumThreads.Value > 0, nameof(options.NumThreads), "Cannot be 0 or negative"); 196Contracts.AssertNonEmpty(options.OutputFolderName);
ISweeper.cs (2)
239throw Contracts.Except("Run result does not contain a metric"); 247Contracts.Check(otherTyped != null);
Parameters.cs (16)
137Contracts.Check(!float.IsNaN(value)); 221Contracts.Check(options.Min < options.Max, "min must be less than max"); 223Contracts.Check(!options.LogBase || options.Min > 0, "min must be positive if log scale is used"); 224Contracts.Check(!options.LogBase || options.StepSize == null || options.StepSize > 1, "StepSize must be greater than 1 if log scale is used"); 225Contracts.Check(options.LogBase || options.StepSize == null || options.StepSize > 0, "StepSize must be greater than 0 if linear scale is used"); 316Contracts.Check(valueTyped != null, "LongValueGenerator could not normalized parameter because it is not of the correct type"); 317Contracts.Check(_options.Min <= valueTyped.Value && valueTyped.Value <= _options.Max, "Value not in correct range"); 331Contracts.Check(valueTyped != null, "Parameter should be of type LongParameterValue"); 353Contracts.Check(options.Min < options.Max, "min must be less than max"); 355Contracts.Check(!options.LogBase || options.Min > 0, "min must be positive if log scale is used"); 356Contracts.Check(!options.LogBase || options.StepSize == null || options.StepSize > 1, "StepSize must be greater than 1 if log scale is used"); 357Contracts.Check(options.LogBase || options.StepSize == null || options.StepSize > 0, "StepSize must be greater than 0 if linear scale is used"); 440Contracts.Check(valueTyped != null, "FloatValueGenerator could not normalized parameter because it is not of the correct type"); 441Contracts.Check(_options.Min <= valueTyped.Value && valueTyped.Value <= _options.Max, "Value not in correct range"); 455Contracts.Check(valueTyped != null, "Parameter should be of type FloatParameterValue"); 476Contracts.Check(options.Values.Length > 0);
SweepCommand.cs (1)
62Contracts.CheckValue(env, nameof(env));
SweepResultEvaluator.cs (1)
34Contracts.CheckValue(env, nameof(env));
Microsoft.ML.TensorFlow (19)
TensorflowTransform.cs (11)
130Contracts.CheckValue(env, nameof(env)); 192Contracts.CheckValue(env, nameof(env)); 211Contracts.CheckValue(env, nameof(env)); 289: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(TensorFlowTransformer))) 543base(Contracts.CheckRef(parent, nameof(parent)).Host.Register(nameof(Mapper)), inputSchema, parent) 597throw Contracts.Except($"Input shape mismatch: Input '{_parent.Inputs[i]}' has shape {originalShape.ToString()}, but input data is of length {typeValueCount}."); 616throw Contracts.Except($"Input shape mismatch: Input '{_parent.Inputs[i]}' has shape {originalShape.ToString()}, but input data is of length {typeValueCount}."); 655Contracts.Assert(input.Schema == InputSchema); 766Contracts.Assert(tensors.Length > 0); 799Contracts.CheckValue(env, nameof(env)); 1003_host = Contracts.CheckRef(env, nameof(env)).Register(nameof(TensorFlowEstimator));
TensorflowUtils.cs (8)
264Contracts.Check(env != null, nameof(env)); 273Contracts.Check(env != null, nameof(env)); 287Contracts.Check(env != null, nameof(env)); 316throw Contracts.ExceptParam(nameof(folder), $"Failed to create folder for the provided path: {folder}. \nException: {exc.Message}"); 323Contracts.Check(env != null, nameof(env)); 385throw Contracts.ExceptParam(nameof(folder), $"Failed to create folder for the provided path: {folder}. \nException: {exc.Message}"); 401Contracts.Check(env != null, nameof(env)); 415throw Contracts.ExceptEmpty(nameof(tensor));
Microsoft.ML.TestFramework (103)
BaseTestBaseline.cs (28)
95Contracts.Check(Directory.Exists(baselineRootDir)); 188Contracts.Assert(IsActive); 202Contracts.AssertValue(LogWriter); 217Contracts.Assert(IsActive); 218Contracts.Assert(!_normal, "Done() should only be called once!"); 240Contracts.Assert(IsActive); 255Contracts.Assert(IsActive); 256Contracts.AssertValue(LogWriter); 263Contracts.Assert(IsActive); 264Contracts.AssertValue(LogWriter); 271Contracts.Assert(IsActive); 280Contracts.Assert(IsActive); 403Contracts.Assert(IsActive); 404Contracts.AssertValue(dir); // Can be empty. 405Contracts.AssertNonEmpty(name); 406Contracts.AssertNonEmpty(nameBase); 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"); 440Contracts.AssertValue(suffix); 441Contracts.AssertValue(seq); 442Contracts.AssertValueOrNull(equalFunc); 462Contracts.Assert(suffixList.Count == seqList.Count); 493Contracts.Assert(skip >= 0); 494Contracts.AssertValueOrNull(tailSignature); 509Contracts.Assert(skip >= 0); 982throw Contracts.Except(inner, "MTA thread failed"); 1000Contracts.CheckNonWhiteSpace(path, nameof(path)); 1012Contracts.CheckNonWhiteSpace(path, nameof(path));
BaseTestPredictorsMaml.cs (8)
97Contracts.Assert(IsActive); 217Contracts.Assert(predOutPath != null); 252Contracts.Assert(foundOut); 286Contracts.Assert(IsActive); 328Contracts.Check(dataset.testSettings == null, "Separate test loader pipeline is not supported"); 346Contracts.Assert(IsActive); 361Contracts.Assert(IsActive); 372Contracts.Assert(IsActive);
BytesStreamSource.cs (3)
23Contracts.AssertValue(data); 34Contracts.Check(index == 0); 40Contracts.Check(index == 0);
DataPipe\TestDataPipeBase.cs (17)
36Contracts.AssertValue(estimator); 37Contracts.AssertValue(validFitInput); 38Contracts.AssertValueOrNull(validTransformInput); 39Contracts.AssertValueOrNull(invalidInput); 185Contracts.AssertValue(Env); 640Contracts.Assert(!IsPassing); 646Contracts.AssertValue(type1); 647Contracts.AssertValue(type2); 654Contracts.Assert(view1.Schema.Count == view2.Schema.Count); 703Contracts.Assert(curs1.Schema.Count == curs2.Schema.Count); 763Contracts.Assert(curs1.Position == curs2.Position); 784Contracts.Assert(curs1.Schema.Count == view2.Schema.Count); 794Contracts.Assert(curs1.IsColumnActive(curs1.Schema[col])); 804Contracts.Assert(cursors[col] != null); 838Contracts.Assert(curs1.Position == cursors[col].Position); 934Contracts.Assert(size >= 0); 981throw Contracts.Except("Unknown type in GetColumnComparer: '{0}'", type);
GlobalBase.cs (5)
25var prev = Contracts.SetAssertHandler(AssertHandler); 26Contracts.Check(prev == null, "Expected to replace null assertion handler!"); 64var prev = Contracts.SetAssertHandler(null); 65Contracts.Check(prev == AssertHandler, "Expected to replace Global.AssertHandler!"); 93Contracts.Assert(false, "This should invoke the handler");
Learners.cs (1)
43Contracts.Check(ok, "Missing assemblies!");
SubComponent.cs (9)
104Contracts.AssertValue(_kind); 105Contracts.AssertValue(_settings); 178throw Contracts.Except("Invalid SubComponent string: mismatched braces, or empty component name."); 190Contracts.AssertValueOrNull(kind); 191Contracts.AssertValueOrNull(args); 202Contracts.AssertValueOrNull(kind); 203Contracts.AssertValueOrNull(args); 209Contracts.Check(type != null && typeof(SubComponent).IsAssignableFrom(type)); 254throw Contracts.Except("Unknown loadable class: {0}", Kind).MarkSensitive(MessageSensitivity.None);
TestCommandBase.cs (32)
60Contracts.AssertValue(test); 61Contracts.AssertValue(dir); 62Contracts.AssertValue(name); 72Contracts.Assert(CanBeBaselined); 78Contracts.Assert(CanBeBaselined); 84Contracts.AssertNonEmpty(name); 109Contracts.Assert(CanBeBaselined); 117Contracts.Assert(CanBeBaselined); 125Contracts.Assert(CanBeBaselined); 206Contracts.AssertValue(path); 208Contracts.Assert((argUsage == Usage.None) != (Utils.Size(names) >= 1)); 237Contracts.AssertValue(test); 238Contracts.AssertValue(dir); 239Contracts.AssertValue(namePrefix); 249Contracts.AssertValue(suffix); 294Contracts.AssertValue(cmdName); 295Contracts.AssertValueOrNull(args); 330Contracts.AssertValue(env); 331Contracts.AssertValue(writer); 347Contracts.Assert(skip >= 0); 374Contracts.AssertNonEmpty(cmdName); 375Contracts.AssertValueOrNull(dataPath); 376Contracts.AssertValueOrNull(inModelPath); 377Contracts.AssertValueOrNull(outModelPath); 378Contracts.AssertValueOrNull(loaderArgs); 379Contracts.AssertValueOrNull(extraArgs); 380Contracts.Assert(Utils.Size(toCompare) == 0 || toCompare.All(x => x != null)); 507Contracts.AssertValue(ctx); 508Contracts.AssertValue(cmdName); 509Contracts.AssertValue(dataPath); 524Contracts.AssertValueOrNull(dataPath); 646Contracts.AssertValue(suffix);
Microsoft.ML.Tests (19)
ExpressionLanguageTests\ExpressionLanguageTests.cs (18)
159Contracts.Assert(ichMin < ichLimChars && ichLimChars < ichLim); 190Contracts.Assert(TestFuncs1.Writer == null); 227Contracts.Assert(ichMin < ichCol && ichCol < ichLim); 234Contracts.Assert(tmp); 244Contracts.AssertValue(del); 245Contracts.AssertNonEmpty(types); 273Contracts.Assert(vals.Length == getters.Length); 343Contracts.Assert(false); 395Contracts.Assert(false); 402Contracts.AssertValue(wrt); 403Contracts.AssertValue(lineMap); 404Contracts.AssertNonEmpty(phase); 405Contracts.AssertNonEmpty(errors); 412Contracts.AssertValue(tok); 633Contracts.AssertValue(funcs); 637Contracts.Assert(funcs[i] != null); 638Contracts.Assert(funcs[i].Target == null); 639Contracts.Assert(funcs[i].GetMethodInfo() != null);
TrainerEstimators\SymSgdClassificationTests.cs (1)
61Contracts.Assert(col12Diff && col23Diff && col13Diff);
Microsoft.ML.TimeSeries (188)
AdaptiveSingularSpectrumSequenceModeler.cs (33)
233Contracts.CheckValue(env, nameof(env)); 340Contracts.CheckValue(env, nameof(env)); 525Contracts.Assert(tMat != null); 526Contracts.Assert(1 <= rank && rank <= tMat.WindowSize); 527Contracts.Assert(Utils.Size(singularVectors) >= tMat.WindowSize * rank); 528Contracts.Assert(Utils.Size(output) >= tMat.SeriesLength); 531Contracts.Assert(k > 0); 549Contracts.Assert(tMat != null); 550Contracts.Assert(1 <= rank && rank <= tMat.WindowSize); 551Contracts.Assert(Utils.Size(singularVectors) >= tMat.WindowSize * rank); 554Contracts.Assert(Utils.Size(output) >= len); 597Contracts.Assert(Utils.Size(alpha) > 0); 598Contracts.Assert(Utils.Size(signal) > 2 * Utils.Size(alpha)); // To assure that the autoregression noise variance is unbiased. 599Contracts.Assert(Utils.Size(series) >= Utils.Size(signal) + startIndex); 604Contracts.Assert(k > 0); 639Contracts.Assert(autoregressionNoiseVariance >= 0); 645Contracts.Assert(tMat != null); 646Contracts.Assert(Utils.Size(series) >= tMat.SeriesLength); 647Contracts.Assert(Utils.Size(outputSignal) >= tMat.SeriesLength); 648Contracts.Assert(Utils.Size(singularVectors) >= tMat.WindowSize * tMat.WindowSize); 649Contracts.Assert(Utils.Size(singularValues) >= tMat.WindowSize); 650Contracts.Assert(1 <= maxRank && maxRank <= tMat.WindowSize - 1); 654Contracts.Assert(k > 0); 740Contracts.Assert(tMat != null); 741Contracts.Assert(Utils.Size(series) >= tMat.SeriesLength); 742Contracts.Assert(Utils.Size(singularVectors) >= tMat.WindowSize * tMat.WindowSize); 743Contracts.Assert(Utils.Size(singularValues) >= tMat.WindowSize); 744Contracts.Assert(1 <= maxRank && maxRank <= tMat.WindowSize - 1); 748Contracts.Assert(k > 0); 1502Contracts.CheckParam(0 <= confidenceLevel && confidenceLevel < 1, nameof(confidenceLevel), "The confidence level must be in [0, 1)."); 1503Contracts.CheckValue(forecast, nameof(forecast)); 1504Contracts.Check(forecast.CanComputeForecastIntervals, "The forecast intervals cannot be computed for this forecast object."); 1509Contracts.Check(sdForecast.Length >= horizon, "The forecast standard deviation values are not available.");
EigenUtils.cs (3)
22Contracts.Assert(n * n == count); 513Contracts.CheckParam(size > 0, nameof(size), "The input matrix size must be strictly positive."); 515Contracts.Check(Utils.Size(input) >= n2, "The input matrix must at least have " + n2 + " elements");
FftUtils.cs (25)
208throw Contracts.Except(Marshal.PtrToStringAnsi(ErrorMessage(status))); 221Contracts.CheckValue(inputRe, nameof(inputRe)); 222Contracts.CheckValue(inputIm, nameof(inputIm)); 223Contracts.CheckValue(outputRe, nameof(outputRe)); 224Contracts.CheckValue(outputIm, nameof(outputIm)); 225Contracts.CheckParam(length > 0, nameof(length), "The length parameter must be greater than 0."); 226Contracts.Check(inputRe.Length >= length && inputIm.Length >= length && outputRe.Length >= length && outputIm.Length >= length, 266Contracts.CheckValue(inputRe, nameof(inputRe)); 267Contracts.CheckValue(inputIm, nameof(inputIm)); 268Contracts.CheckValue(outputRe, nameof(outputRe)); 269Contracts.CheckValue(outputIm, nameof(outputIm)); 270Contracts.CheckParam(length > 0, nameof(length), "The length parameter must be greater than 0."); 271Contracts.Check(inputRe.Length >= length && inputIm.Length >= length && outputRe.Length >= length && outputIm.Length >= length, 323Contracts.CheckValue(inputRe, nameof(inputRe)); 324Contracts.CheckValue(inputIm, nameof(inputIm)); 325Contracts.CheckValue(outputRe, nameof(outputRe)); 326Contracts.CheckValue(outputIm, nameof(outputIm)); 327Contracts.CheckParam(length > 0, nameof(length), "The length parameter must be greater than 0."); 328Contracts.Check(inputRe.Length >= length && inputIm.Length >= length && outputRe.Length >= length && outputIm.Length >= length, 368Contracts.CheckValue(inputRe, nameof(inputRe)); 369Contracts.CheckValue(inputIm, nameof(inputIm)); 370Contracts.CheckValue(outputRe, nameof(outputRe)); 371Contracts.CheckValue(outputIm, nameof(outputIm)); 372Contracts.CheckParam(length > 0, nameof(length), "The length parameter must be greater than 0."); 373Contracts.Check(inputRe.Length >= length && inputIm.Length >= length && outputRe.Length >= length && outputIm.Length >= length,
IidAnomalyDetectionBase.cs (1)
172Contracts.Assert(state is State);
IidChangePointDetector.cs (5)
103Contracts.CheckValue(env, nameof(env)); 141Contracts.CheckValue(env, nameof(env)); 151Contracts.CheckValue(env, nameof(env)); 238: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(IidChangePointEstimator)), 252: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(IidChangePointEstimator)),
IidSpikeDetector.cs (5)
99Contracts.CheckValue(env, nameof(env)); 123Contracts.CheckValue(env, nameof(env)); 133Contracts.CheckValue(env, nameof(env)); 216: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(IidSpikeDetector)), 229: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(IidSpikeEstimator)), new IidSpikeDetector(env, options))
MovingAverageTransform.cs (3)
204Contracts.Assert(FloatUtils.IsFinite(lastDropped) || Single.IsNaN(lastDropped)); 214Contracts.Assert(FloatUtils.IsFinite(newValue) || Single.IsNaN(newValue)); 228Contracts.Assert(FloatUtils.IsFinite(currentSum) || Single.IsNaN(currentSum));
PolynomialUtils.cs (14)
44Contracts.Assert(Utils.Size(coefficients) > 1); 72Contracts.CheckParam(doublePrecision > 0, nameof(doublePrecision), "The double precision must be positive."); 73Contracts.CheckParam(Utils.Size(coefficients) >= 1, nameof(coefficients), "There must be at least one input coefficient."); 140Contracts.Assert(multiplicity > 0); 193Contracts.Assert(uIndex >= 0); 194Contracts.Assert(uLen >= 1); 195Contracts.Assert(uIndex + uLen <= Utils.Size(Coefficients)); 196Contracts.Assert(vIndex >= 0); 197Contracts.Assert(vLen >= 1); 198Contracts.Assert(vIndex + vLen <= Utils.Size(Coefficients)); 199Contracts.Assert(uIndex + uLen <= vIndex || vIndex + vLen <= uIndex); // makes sure the input ranges are non-overlapping. 200Contracts.Assert(dstIndex >= 0); 201Contracts.Assert(dstIndex + uLen + vLen <= Utils.Size(destination)); 281Contracts.CheckParam(Utils.Size(roots) > 0, nameof(roots), "There must be at least 1 input root.");
PredictionEngine.cs (12)
87Contracts.CheckValue(env, nameof(env)); 110Contracts.CheckValue(env, nameof(env)); 162Contracts.CheckValue(input, nameof(input)); 163Contracts.CheckValue(activeColumns, nameof(activeColumns)); 180throw Contracts.ExceptParam(nameof(input), $"Mapper required column '{input.Schema[c].Name}' active but it was not."); 238Contracts.CheckValue(inputSchema, nameof(inputSchema)); 239Contracts.Check(IsRowToRowMapper(InputTransformer), nameof(GetRowToRowMapper) + 248Contracts.Check(InputTransformer is ITransformerChainAccessor); 287Contracts.CheckValue(example, nameof(example)); 325Contracts.CheckValue(example, nameof(example)); 404Contracts.CheckValue(env, nameof(env)); 434Contracts.CheckValue(env, nameof(env));
SequentialAnomalyDetectionTransformBase.cs (4)
171: base(Contracts.CheckRef(env, nameof(env)).Register(name), windowSize, initialWindowSize, outputColumnName, inputColumnName, new VectorDataViewType(NumberDataViewType.Double, GetOutputLength(alertingScore, env))) 199: base(Contracts.CheckRef(env, nameof(env)).Register(name), ctx) 311Contracts.CheckValue(env, nameof(env)); 450Contracts.Assert(state is AnomalyDetectionStateBase);
SequentialForecastingTransformBase.cs (3)
62: base(Contracts.CheckRef(env, nameof(env)).Register(name), windowSize, initialWindowSize, 76: base(Contracts.CheckRef(env, nameof(env)).Register(name), ctx) 108Contracts.CheckValue(env, nameof(env));
SequentialTransformBase.cs (3)
116Contracts.CheckValue(host, nameof(host), "The host cannot be null."); 270: this(windowSize, initialWindowSize, outputColumnName, inputColumnName, Contracts.CheckRef(env, nameof(env)).Register(name), input, outputColTypeOverride) 278Contracts.AssertValue(Host);
SequentialTransformerBase.cs (22)
99Contracts.CheckValue(host, nameof(host), "The host cannot be null."); 118Contracts.CheckValue(host, nameof(host), "The host cannot be null."); 592return new SequentialDataTransform(Contracts.CheckRef(env, nameof(env)).Register("SequentialDataTransform"), _parent, newSource, _mapper); 637Contracts.CheckValue(bindings, nameof(bindings)); 638Contracts.CheckValue(input, nameof(input)); 666Contracts.CheckParam(index < _getters.Length, nameof(column), "Invalid col value in GetGetter"); 667Contracts.Check(IsColumnActive(column)); 670throw Contracts.Except("Unexpected TValue in GetGetter"); 675_pinger as Action<PingerArgument> ?? throw Contracts.Except("Invalid TValue in GetPinger: '{0}'", typeof(PingerArgument)); 683Contracts.Check(index < _getters.Length); 761Contracts.CheckValue(mapper, nameof(mapper)); 768Contracts.CheckValue(inputSchema, nameof(inputSchema)); 769Contracts.CheckValue(mapper, nameof(mapper)); 785Contracts.CheckValue(env, nameof(env)); 814Contracts.Assert(active.Length == n); 817Contracts.Assert(activeInput.Length == _bindings.InputSchema.Count); 847Contracts.AssertValue(active); 848Contracts.Assert(active.Length == _bindings.Schema.Count); 853Contracts.Assert(0 <= col && col < _bindings.AddedColumnIndices.Count); 991Contracts.Assert(originFn != null); 994throw Contracts.Except($"Invalid TValue in GetGetter: '{typeof(TValue)}', " + 1000_pinger as Action<PingerArgument> ?? throw Contracts.Except("Invalid TValue in GetPinger: '{0}'", typeof(PingerArgument));
SrCnnAnomalyDetectionBase.cs (1)
162Contracts.Assert(state is State);
SRCNNAnomalyDetector.cs (5)
114Contracts.CheckValue(env, nameof(env)); 123Contracts.CheckValue(env, nameof(env)); 132Contracts.CheckValue(env, nameof(env)); 249: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(SrCnnAnomalyEstimator)), 265: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(SrCnnAnomalyEstimator)), new SrCnnAnomalyDetector(env, options))
SrCnnEntireAnomalyDetector.cs (4)
159Contracts.Check(iinfo == 0); 166Contracts.AssertValue(predicate); 306throw Contracts.Except("The input must contain no less than 12 points."); 475Contracts.Assert(deseasonalityMode == SrCnnDeseasonalityMode.Median);
SrCnnTransformBase.cs (4)
71: base(Contracts.CheckRef(env, nameof(env)).Register(name), windowSize, initialWindowSize, outputColumnName, inputColumnName, new VectorDataViewType(NumberDataViewType.Double, 3)) 89: base(Contracts.CheckRef(env, nameof(env)).Register(name), ctx) 154Contracts.CheckValue(env, nameof(env)); 272Contracts.Assert(state is SrCnnStateBase);
SsaAnomalyDetectionBase.cs (2)
77throw Contracts.Except(ErrorFunctionHelpText); 319Contracts.Assert(state is State);
SsaChangePointDetector.cs (4)
112Contracts.CheckValue(env, nameof(env)); 151Contracts.CheckValue(env, nameof(env)); 161Contracts.CheckValue(env, nameof(env)); 275Contracts.CheckValue(env, nameof(env));
SSaForecasting.cs (4)
137Contracts.CheckValue(env, nameof(env)); 153Contracts.CheckValue(env, nameof(env)); 172Contracts.CheckValue(env, nameof(env)); 306Contracts.CheckValue(env, nameof(env));
SsaForecastingBase.cs (1)
237Contracts.Assert(state is State);
SsaSpikeDetector.cs (4)
109Contracts.CheckValue(env, nameof(env)); 125Contracts.CheckValue(env, nameof(env)); 144Contracts.CheckValue(env, nameof(env)); 254Contracts.CheckValue(env, nameof(env));
STL\FastLoess.cs (3)
42Contracts.CheckValue(xValues, nameof(xValues)); 43Contracts.CheckValue(yValues, nameof(yValues)); 47throw Contracts.Except("input data structure cannot be 0-length: lowess");
STL\InnerStl.cs (3)
119Contracts.CheckValue(yValues, nameof(yValues)); 120Contracts.CheckParam(np > 0, nameof(np)); 123throw Contracts.Except(string.Format("input time series length for InnerStl is below {0}", MinTimeSeriesLength));
STL\LeastSquares.cs (7)
28Contracts.CheckValue(x, nameof(x)); 29Contracts.CheckValue(y, nameof(y)); 32throw Contracts.Except("input data structure cannot be 0-length"); 34throw Contracts.Except("the x-axis length should be equal to y-axis length!"); 46Contracts.CheckValue(weights, nameof(weights)); 48Contracts.CheckParam(weights.Count == _length, nameof(weights)); 50throw Contracts.Except("The length of the weight vector is not equal to the length of the data points.");
STL\Loess.cs (4)
49Contracts.CheckValue(xValues, nameof(xValues)); 50Contracts.CheckValue(yValues, nameof(yValues)); 53throw Contracts.Except(string.Format("input time series length for Loess is below {0}", MinTimeSeriesLength)); 56throw Contracts.Except("the x-axis length should be equal to y-axis length!: lowess");
STL\PolynomialModel.cs (2)
16Contracts.CheckValue(coeffs, nameof(coeffs)); 64Contracts.CheckParam(coeffs.Count == 2, nameof(coeffs), "must contain exact 2 elements.");
TimeSeriesUtils.cs (6)
16Contracts.Check(queue != null, nameof(queue)); 17Contracts.Assert(queue.Capacity >= 0); 18Contracts.Assert(queue.Count <= queue.Capacity); 45Contracts.Check(queue != null, nameof(queue)); 46Contracts.Assert(queue.Capacity >= 0); 47Contracts.Assert(queue.Count <= queue.Capacity);
TrajectoryMatrix.cs (1)
115Contracts.CheckValueOrNull(ectx);
Microsoft.ML.TorchSharp (42)
AutoFormerV2\ObjectDetectionTrainer.cs (12)
123Host = Contracts.CheckRef(env, nameof(env)).Register(nameof(ObjectDetectionTrainer)); 124Contracts.Assert(options.MaxEpoch > 0); 125Contracts.AssertValue(options.BoundingBoxColumnName); 126Contracts.AssertValue(options.LabelColumnName); 127Contracts.AssertValue(options.ImageColumnName); 128Contracts.AssertValue(options.ScoreColumnName); 129Contracts.AssertValue(options.PredictedLabelColumnName); 398Contracts.Assert(boxValues.Length == labelValues.Length * 4, "Must have 4 coordinates for each label"); 522: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ObjectDetectionTransformer))) 656Contracts.CheckValue(env, nameof(env)); 731base(Contracts.CheckRef(parent, nameof(parent)).Host.Register(nameof(ObjDetMapper)), inputSchema, parent) 879Contracts.Assert(input.Schema == base.InputSchema);
NasBert\Models\NasBertEncoder.cs (2)
76Contracts.AssertValue(arches); 77Contracts.AssertNonEmpty(arches);
NasBert\NasBertTrainer.cs (3)
172Contracts.AssertValue(BertOptions.Sentence1ColumnName); 173Contracts.Assert(BertOptions.TaskType != BertTaskType.None, "BertTaskType must be specified"); 420: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(NasBertTransformer<TLabelCol, TTargetsCol>)), options, model, labelColumn)
NasBert\NerTrainer.cs (1)
305Contracts.CheckValue(env, nameof(env));
NasBert\SentenceSimilarityTrainer.cs (1)
220Contracts.CheckValue(env, nameof(env));
NasBert\TextClassificationTrainer.cs (1)
242Contracts.CheckValue(env, nameof(env));
Roberta\QATrainer.cs (12)
104Host = Contracts.CheckRef(env, nameof(env)).Register(nameof(QATrainer)); 105Contracts.Assert(options.MaxEpoch > 0); 106Contracts.AssertValue(options.ContextColumnName); 107Contracts.AssertValue(options.QuestionColumnName); 108Contracts.AssertValue(options.TrainingAnswerColumnName); 109Contracts.AssertValue(options.AnswerIndexStartColumnName); 110Contracts.AssertValue(options.ScoreColumnName); 111Contracts.AssertValue(options.PredictedAnswerColumnName); 573: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(QATransformer))) 676Contracts.CheckValue(env, nameof(env)); 713base(Contracts.CheckRef(parent, nameof(parent)).Host.Register(nameof(QAMapper)), inputSchema, parent) 830Contracts.Assert(input.Schema == base.InputSchema);
TorchSharpBaseTrainer.cs (8)
89Host = Contracts.CheckRef(env, nameof(env)).Register(nameof(TorchSharpBaseTrainer)); 90Contracts.Assert(options.BatchSize > 0); 91Contracts.Assert(options.MaxEpoch > 0); 92Contracts.AssertValue(options.LabelColumnName); 93Contracts.AssertValue(options.PredictionColumnName); 389: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(TorchSharpBaseTransformer))) 456base(Contracts.CheckRef(parent, nameof(parent)).Host.Register(nameof(TorchSharpBaseMapper)), inputSchema, parent) 493Contracts.Assert(input.Schema == base.InputSchema);
Utils\DataUtils.cs (2)
20Contracts.AssertNonEmpty(values, "Can't collate 0 values"); 21Contracts.Assert(values.All(v => v.dim() == 1), "All tensors should be 1D to collate.");
Microsoft.ML.Transforms (1106)
CompositeTransformer.cs (3)
37Contracts.CheckValue(ctx, nameof(ctx)); 39Contracts.CheckValue(input, nameof(input)); 49Contracts.CheckDecode(numFunctions > 0);
CountFeatureSelection.cs (13)
115Contracts.CheckValue(Name, nameof(Name)); 118Contracts.CheckValue(InputColumnName, nameof(InputColumnName)); 119Contracts.CheckParam(count >= 0, nameof(count), "Must be non-negative."); 136Contracts.CheckValue(env, nameof(env)); 229Contracts.CheckValue(env, nameof(env)); 244Contracts.Assert(size > 0); 245Contracts.Assert(Utils.Size(scores) == size); 246Contracts.AssertValue(columnOptions); 247Contracts.Assert(Utils.Size(columnOptions) == size); 295Contracts.CheckValue(env, nameof(env)); 392Contracts.Assert(type is PrimitiveDataViewType); 409Contracts.Assert(type.IsKnownSize); 432Contracts.Check(value.Length == size);
CustomMappingFilter.cs (3)
27Contracts.CheckValue(env, nameof(env)); 99Contracts.AssertValue(parent); 165Contracts.AssertValue(parent);
CustomMappingTransformer.cs (6)
47Contracts.CheckValue(env, nameof(env)); 119Contracts.AssertValue(parent); 120Contracts.AssertValue(inputSchema); 244: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(CustomMappingEstimator<TSrc, TDst>)), 263throw Contracts.ExceptSchemaMismatch(nameof(inputSchema), "input", col.ColumnName); 272throw Contracts.ExceptSchemaMismatch(nameof(inputSchema), "input", col.ColumnName, col.ColumnType.ToString(), column.GetTypeString());
Dracula\CMCountTable.cs (17)
52Contracts.CheckValue(tables, nameof(tables)); 53Contracts.Assert(LabelCardinality > 0); 54Contracts.Assert(Utils.Size(tables[0]) == depth); 57Contracts.Check(Depth > 0, "depth must be positive"); 58Contracts.Check(tables.All(x => Utils.Size(x) == Depth), "Depth must be the same for all labels"); 61Contracts.Check(Width > 0, "width must be positive"); 62Contracts.Check(tables.All(t => t.All(t2 => t2.Max(kvp => kvp.Key) < Width)), "Keys must be between 0 and Width - 1"); 69Contracts.CheckValue(env, nameof(env)); 113Contracts.CheckValue(ctx, nameof(ctx)); 147Contracts.Assert(counts.Length == LabelCardinality); 158Contracts.Assert(count >= 0); 199Contracts.Check(0 < depth && depth < DepthLim, "Depth out of range"); 200Contracts.Check(0 < width, "Width out of range"); 206: this(Contracts.CheckRef(options, nameof(options)).Depth, options.Width) 221Contracts.Assert(0 < depth && depth < DepthLim); 224Contracts.Assert(0 < width); 239Contracts.AssertValue(table);
Dracula\CountTable.cs (16)
49Contracts.Check(0 < labelCardinality && labelCardinality < LabelCardinalityLim, "Label cardinality out of bounds"); 50Contracts.CheckValue(priorCounts, nameof(priorCounts)); 51Contracts.Check(priorCounts.All(x => x >= 0)); 52Contracts.Check(priorCounts.Length == labelCardinality); 53Contracts.Check(garbageThreshold >= 0, "Garbage threshold must be non-negative"); 57Contracts.CheckValue(garbageCounts, nameof(garbageCounts)); 58Contracts.Check(garbageCounts.Length == labelCardinality); 59Contracts.Check(garbageCounts.All(x => x >= 0)); 117Contracts.AssertValue(ctx); 125Contracts.Assert(0 < LabelCardinality && LabelCardinality < LabelCardinalityLim); 128Contracts.Assert(Utils.Size(_priorFrequencies) == LabelCardinality); 129Contracts.Assert(_priorFrequencies.All(x => x >= 0)); 132Contracts.Assert(GarbageThreshold >= 0); 136Contracts.Assert(Utils.Size(_garbageCounts) == 0); 139Contracts.Assert(Utils.Size(_garbageCounts) == LabelCardinality); 140Contracts.Assert(_garbageCounts.All(x => x >= 0));
Dracula\CountTableBuilder.cs (2)
53Contracts.CheckParam(LabelCardinality == labelCardinality, nameof(labelCardinality), "Label cardinality must be less than int.MaxValue"); 60Contracts.Check(0 <= labelKey && labelKey < LabelCardinality);
Dracula\CountTableTransformer.cs (8)
104Contracts.CheckValue(initial, nameof(initial)); 106throw Contracts.ExceptParam(nameof(columns), $"New estimator applied {columns.Length} columns, but old transformer applied to {initial.Featurizer.PriorCoef.Length} columns"); 118Contracts.CheckValue(env, nameof(env)); 405Contracts.AssertValue(sb); 443: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(CountTableTransformer)), columns) 465Contracts.CheckValue(env, nameof(env)); 520Contracts.CheckValue(env, nameof(env)); 740Contracts.CheckValue(env, nameof(env));
Dracula\CountTargetEncodingTransformer.cs (7)
143Contracts.CheckValue(env, nameof(env)); 157Contracts.CheckValue(env, nameof(env)); 167Contracts.CheckValue(env, nameof(env)); 278Contracts.CheckValue(env, nameof(env)); 332Contracts.AssertValue(env); 368Contracts.CheckValue(env, nameof(env)); 544Contracts.CheckValue(env, nameof(env));
Dracula\DictCountTable.cs (9)
50Contracts.CheckValue(counts, nameof(counts)); 51Contracts.Check(counts.Length == labelCardinality, "Counts must be parallel to label cardinality"); 52Contracts.Check(counts.All(x => x != null), "Count dictionaries must all exist"); 58Contracts.CheckValue(env, nameof(env)); 93Contracts.CheckValue(ctx, nameof(ctx)); 110Contracts.Assert(pair.Value >= 0); 118Contracts.Check(counts.Length == LabelCardinality); 154: this(Contracts.CheckRef(args, nameof(args)).GarbageThreshold) 160Contracts.CheckParam(garbageThreshold >= 0, nameof(garbageThreshold), "Garbage threshold must be non-negative");
Dracula\Featurizer.cs (4)
47Contracts.CheckValue(env, nameof(env)); 65Contracts.CheckValue(env, nameof(env)); 98Contracts.CheckValue(ctx, nameof(ctx)); 127Contracts.Check(Utils.Size(classNames) == _labelBinCount, "incorrect class names");
Dracula\MultiCountTable.cs (8)
46Contracts.CheckValue(env, nameof(env)); 70Contracts.CheckValue(env, nameof(env)); 90Contracts.AssertValue(env, nameof(env)); 247Contracts.CheckValue(env, nameof(env)); 261Contracts.CheckValue(env, nameof(env)); 328Contracts.CheckValue(ctx, nameof(ctx)); 380Contracts.CheckValue(baseCountTable, nameof(baseCountTable)); 381Contracts.Check(baseCountTable.GarbageThreshold == 0, "Garbage bin not supported for shared table");
EntryPoints\SelectFeatures.cs (2)
21Contracts.CheckValue(env, nameof(env)); 36Contracts.CheckValue(env, nameof(env));
EntryPoints\TextAnalytics.cs (3)
101Contracts.CheckValue(env, nameof(env)); 119Contracts.CheckValue(env, nameof(env)); 140Contracts.CheckValue(env, nameof(env));
Expression\BuiltinFunctions.cs (28)
42Contracts.Assert(type == typeof(BL) || type == typeof(I4) || type == typeof(I8) || type == typeof(TX), 56Contracts.Assert(false, "Unexpected constant value type!"); 65Contracts.AssertValue(funcs); 74Contracts.AssertValue(fn); 75Contracts.Assert(fn.Target == null); 84Contracts.AssertValue(fn); 85Contracts.Assert(fn.Target == null); 94Contracts.AssertValue(fn); 95Contracts.Assert(fn.Target == null); 104Contracts.AssertValue(fn); 105Contracts.Assert(fn.Target == null); 134Contracts.Assert(fn.Target == null); 370Contracts.CheckNonEmpty(name, nameof(name)); 371Contracts.CheckValue(fn, nameof(fn)); 372Contracts.CheckParam(Utils.Size(values) > 0, nameof(values), "Expected values to have positive length"); 373Contracts.CheckParam(!values.All(x => x != null), nameof(values), "Expected values to contain at least one null"); 379Contracts.Assert(values.Length == 1); 390Contracts.Assert(values.Length == 1); 405Contracts.Assert(false, "Unexpected return type!"); 416Contracts.Assert(values.Length > 1); 759Contracts.AssertValue(a); 793Contracts.Assert(0 <= len); 993Contracts.Assert(a >= 2); 996Contracts.Assert(b >= 3); 1013Contracts.Assert(result <= I4.MaxValue); 1063Contracts.Assert(a >= 2); 1066Contracts.Assert(b >= 3); 1092Contracts.Assert(res > 0);
Expression\CharCursor.cs (9)
28: this(Contracts.CheckRef(text, nameof(text)).ToCharArray(), text.Length) 39Contracts.AssertValue(buffer); 40Contracts.Assert(0 <= ichLimInit && ichLimInit <= buffer.Length); 59Contracts.Assert(_ichNext < _ichLim); 63Contracts.Assert(_fNoMore); 72Contracts.Assert(0 < dich && dich <= _ichLim - _ichNext + 1); 80Contracts.Assert(ich < _ichLim); 84Contracts.Assert(_fNoMore); 106Contracts.Assert(ichLim == _ichLim);
Expression\CodeGen.cs (114)
31Contracts.CheckValue(node, nameof(node)); 39Contracts.AssertValue(node); 40Contracts.Assert(1 <= node.Vars.Length && node.Vars.Length <= MaxParams); 41Contracts.Assert(MaxParams <= 16); 42Contracts.AssertValue(node.ResultType); 60throw Contracts.Except("Internal error in LambdaCompiler: Maximum number of inputs exceeded."); 66Contracts.Assert(0 <= v.Index && v.Index < node.Vars.Length); 67Contracts.Assert(types[v.Index] == null); 124Contracts.AssertValue(node); 125Contracts.AssertValue(value); 126Contracts.AssertValueOrNull(flag); 155Contracts.AssertValue(node); 170Contracts.Assert(false, "Unexpected src kind in DoConvert"); 207Contracts.Assert(false, "Unexpected dst kind in DoConvert"); 235Contracts.Assert(value is BL); 239Contracts.Assert(value is I4); 243Contracts.Assert(value is I8); 247Contracts.Assert(value is R4); 251Contracts.Assert(value is R8); 256Contracts.Assert(value is TX); 277Contracts.Assert(node.IsBool); 278Contracts.Assert(node.ExprValue is BL); 284Contracts.Assert(node.IsTX); 285Contracts.Assert(node.ExprValue is TX); 294Contracts.Assert(node.IsNumber); 296Contracts.Assert(value != null); 300Contracts.Assert(value is I4); 304Contracts.Assert(value is I8); 308Contracts.Assert(value is R4); 312Contracts.Assert(value is R8); 316Contracts.Assert(false, "Bad NumLitNode"); 346Contracts.Assert(loc.Value.ExprValue == null); 347Contracts.Assert(loc.GenCount >= 0); 351Contracts.Assert(loc.UseCount == 1); 352Contracts.Assert(loc.Index == -1); 358Contracts.Assert(0 <= loc.Index && loc.Index < _cacheWith.Count); 360Contracts.Assert(cache.Value != null); 406Contracts.AssertValue(node); 411Contracts.Assert(false, "Bad unary op"); 416Contracts.Assert(node.IsNumber); 417Contracts.Assert(node.Arg.ExprType == node.SrcKind); 432Contracts.Assert(false, "Bad operand type in unary minus"); 448Contracts.AssertValue(node); 470Contracts.Assert(false, "Bad binary op"); 503Contracts.AssertValue(node); 504Contracts.Assert(node.Op == BinaryOp.Or || node.Op == BinaryOp.And); 505Contracts.Assert(node.SrcKind == ExprTypeKind.BL); 506Contracts.Assert(node.Left.IsBool); 507Contracts.Assert(node.Right.IsBool); 533Contracts.AssertValue(node); 542Contracts.Assert(node.Left.IsI4); 543Contracts.Assert(node.Right.IsI4); 547Contracts.Assert(false, "Bad numeric bin op"); 573Contracts.Assert(node.Left.IsI8); 574Contracts.Assert(node.Right.IsI8); 578Contracts.Assert(false, "Bad numeric bin op"); 604Contracts.Assert(node.Left.IsR4); 605Contracts.Assert(node.Right.IsR4); 609Contracts.Assert(false, "Bad numeric bin op"); 635Contracts.Assert(node.SrcKind == ExprTypeKind.R8); 636Contracts.Assert(node.Left.IsR8); 637Contracts.Assert(node.Right.IsR8); 641Contracts.Assert(false, "Bad numeric bin op"); 694Contracts.AssertValue(node); 695Contracts.Assert(node.Op == BinaryOp.Coalesce); 698Contracts.Assert(node.Left.ExprValue == null); 713Contracts.Assert(false); 718Contracts.AssertValue(node); 755Contracts.Assert(false); 760Contracts.AssertValue(node); 761Contracts.Assert(node.Operands.Items.Length >= 2); 776Contracts.Assert(false, "Bad bool compare op"); 799Contracts.Assert(arg.ExprType == kind); 801Contracts.Assert(arg.ExprType == kind); 804Contracts.Assert(tid == node.TidLax || tid == node.TidStrict); 828Contracts.Assert(items.Length > 2); 870Contracts.Assert(arg.ExprType == kind); 873Contracts.Assert(arg.ExprType == kind); 878Contracts.Assert(tid == node.TidLax || tid == node.TidStrict); 882Contracts.Assert(arg.ExprType == kind); 906Contracts.Assert(node.Op == CompareOp.NotEqual && items.Length > 2); 915Contracts.Assert(arg.ExprType == kind); 924Contracts.Assert(arg.ExprType == kind); 964Contracts.AssertValue(node); 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"); 1231Contracts.Assert(false); 1236Contracts.AssertValue(node); 1243Contracts.Assert(false, "Bad function"); 1254Contracts.Assert(node.Method.ReturnType != typeof(void)); 1262Contracts.Assert(tail >= 0); 1284Contracts.Assert(Utils.Size(ps) == node.Args.Items.Length); 1291Contracts.Assert(node.Args.Items.Length == 1); 1300Contracts.Assert(false); 1305Contracts.AssertValue(node); 1310Contracts.AssertValue(node); 1313Contracts.Assert(local.Index == -1); 1314Contracts.Assert(local.UseCount >= 0); 1321Contracts.Assert(local.Index == -1); 1347Contracts.Assert(item.Node.UseCount >= 2); 1372Contracts.Assert((flagBldr != null) == lazy); 1389Contracts.Assert(_cacheWith.Count == index + 1); 1394Contracts.Assert(local.Index == index); 1398Contracts.Assert(_cacheWith.Count == index + 1); 1399Contracts.Assert(_cacheWith[index] == cache); 1412Contracts.Assert(false); 1417Contracts.Assert(false); 1423Contracts.Assert(false);
Expression\Error.cs (5)
19Contracts.AssertValue(tok); 20Contracts.AssertNonEmpty(msg); 28Contracts.AssertValue(tok); 29Contracts.AssertNonEmpty(msg); 30Contracts.AssertValue(args);
Expression\Exec.cs (1)
31Contracts.AssertValue(str);
Expression\IlGeneratorExtensions.cs (51)
36Contracts.AssertValue(il); 43Contracts.AssertValue(il); 50Contracts.AssertValue(il); 57Contracts.AssertValue(il); 64Contracts.AssertValue(il); 71Contracts.AssertValue(il); 78Contracts.AssertValue(il); 85Contracts.AssertValue(il); 92Contracts.AssertValue(il); 99Contracts.AssertValue(il); 106Contracts.AssertValue(il); 113Contracts.AssertValue(il); 120Contracts.AssertValue(il); 127Contracts.AssertValue(il); 134Contracts.AssertValue(il); 135Contracts.AssertValue(info); 136Contracts.Assert(!info.IsVirtual); 143Contracts.AssertValue(il); 150Contracts.AssertValue(il); 157Contracts.AssertValue(il); 164Contracts.AssertValue(il); 171Contracts.AssertValue(il); 178Contracts.AssertValue(il); 185Contracts.AssertValue(il); 192Contracts.AssertValue(il); 199Contracts.AssertValue(il); 206Contracts.AssertValue(il); 213Contracts.AssertValue(il); 214Contracts.Assert(0 <= arg && arg <= short.MaxValue); 242Contracts.AssertValue(il); 289Contracts.AssertValue(il); 296Contracts.AssertValue(il); 303Contracts.AssertValue(il); 310Contracts.AssertValue(il); 311Contracts.AssertValue(builder); 318Contracts.AssertValue(il); 319Contracts.AssertValue(str); 326Contracts.AssertValue(il); 333Contracts.AssertValue(il); 340Contracts.AssertValue(il); 347Contracts.AssertValue(il); 348Contracts.AssertValue(type); 355Contracts.AssertValue(il); 362Contracts.AssertValue(il); 369Contracts.AssertValue(il); 376Contracts.AssertValue(il); 377Contracts.AssertValue(type); 384Contracts.AssertValue(il); 385Contracts.AssertValue(builder); 392Contracts.AssertValue(il); 399Contracts.AssertValue(il);
Expression\KeyWordTable.cs (7)
34Contracts.AssertValue(pool); 43Contracts.AssertNonEmpty(str); 49Contracts.AssertNonEmpty(str); 82Contracts.AssertNonEmpty(str); 84Contracts.Assert(false, "duplicate punctuator!"); 89Contracts.Assert(!nstr.Value.IsEmpty); 95Contracts.Assert(!nstr.Value.IsEmpty);
Expression\LambdaBinder.cs (18)
53Contracts.AssertValue(env); 742throw Contracts.Except(); 764throw Contracts.Except(); 1139Contracts.Assert(Kinds.Length > 0); 1199Contracts.Assert(kinds.Length == 1); 1221Contracts.AssertValue(provider); 1222Contracts.AssertValue(meth); 1223Contracts.AssertValue(kinds); 1236Contracts.Assert(kinds.Length == Kinds.Length || IsVariable && kinds.Length >= Kinds.Length - 1); 1268Contracts.AssertValue(other); 1471Contracts.Assert(ExprTypeKind.Error <= src && src < ExprTypeKind._Lim); 1472Contracts.Assert(ExprTypeKind.Error < dst && dst < ExprTypeKind._Lim); 1703Contracts.Assert(0 <= i1 && i1 < 4); 1704Contracts.Assert(0 <= i2 && i2 < 4); 1705Contracts.Assert(i1 != i2); 1709Contracts.Assert(0 <= index && index < 16); 1737Contracts.Assert(false); 1768Contracts.Assert(a is T);
Expression\LambdaParser.cs (43)
26Contracts.AssertValue(lineMap); 27Contracts.Assert(span.Min <= span.Lim); 55Contracts.Assert(index > 0); 64Contracts.Assert(ivMin <= map.Count); 74Contracts.Assert(0 <= ivMin && ivMin <= map.Count); 75Contracts.Assert(ivMin == map.Count || value < map[ivMin]); 76Contracts.Assert(ivMin == 0 || value >= map[ivMin - 1]); 154Contracts.AssertValue(chars); 155Contracts.AssertNonEmpty(types); 156Contracts.Assert(types.Length <= LambdaCompiler.MaxParams); 157Contracts.Assert(Utils.Size(perm) == types.Length); 165Contracts.AssertValue(chars); 166Contracts.AssertNonEmpty(types); 167Contracts.Assert(Utils.Size(perm) == types.Length); 194Contracts.Assert(_errors == null || _errors.Count > 0); 221Contracts.Assert(tidWanted != tok.Kind); 222Contracts.Assert(tidWanted != tok.KindContext); 228Contracts.AssertValue(tok); 277Contracts.Assert(cv > 0); 397Contracts.Assert(0 <= index); 418Contracts.Assert(i < _perm.Length); 419Contracts.Assert(0 <= _perm[i] && _perm[i] < _perm.Length); 451Contracts.Assert(Precedence.None <= precMin); 452Contracts.Assert(precMin <= Precedence.PrefixUnary); 460Contracts.AssertValue(node); 464Contracts.Assert(precMin <= Precedence.Power); 627Contracts.AssertValue(node); 628Contracts.Assert(TidCur == tidLax || TidCur == tidStrict); 641Contracts.Assert(list.Count >= 2); 647Contracts.Assert(TidCur != tidLax); 648Contracts.Assert(TidCur != tidStrict); 676Contracts.Assert(TidCur == TokKind.Ident); 677Contracts.Assert(TidPeek() == TokKind.OpenParen); 680Contracts.Assert(TidCur == TokKind.OpenParen); 688Contracts.Assert(TidCur == TokKind.Ident); 689Contracts.Assert(TidPeek() == TokKind.Dot); 690Contracts.Assert(TidPeek(2) == TokKind.Ident); 691Contracts.Assert(TidPeek(3) == TokKind.OpenParen); 694Contracts.Assert(TidCur == TokKind.Dot); 697Contracts.Assert(TidCur == TokKind.OpenParen); 705Contracts.Assert(TidCur == TokKind.OpenParen); 739Contracts.Assert(TidCur == TokKind.With); 748Contracts.Assert(TidCur == TokKind.Comma);
Expression\LexCharUtils.cs (5)
218Contracts.Assert('0' <= ch && ch <= '9'); 224Contracts.Assert(IsHexDigit(ch)); 227Contracts.Assert(ch <= 'f'); 232Contracts.Assert(ch <= 'F'); 235Contracts.Assert('0' <= ch && ch <= '9');
Expression\Lexer.cs (22)
28Contracts.AssertValue(pool); 29Contracts.AssertValue(kwt); 36Contracts.AssertValue(cursor); 153Contracts.Assert(tok.Kind == TokKind.NewLine || tok.Kind == TokKind.Error); 162Contracts.Assert(Eof); 168Contracts.Assert(!Eof); 250Contracts.Assert(LexCharUtils.StartKind(ChCur) == LexStartKind.NumLit); 251Contracts.Assert(LexCharUtils.IsDigit(ChCur) || ChCur == '.'); 268Contracts.Assert(LexCharUtils.IsDigit(ChCur) || ChCur == '.' && LexCharUtils.IsDigit(ChPeek(1))); 316Contracts.Assert(LexCharUtils.IsHexDigit(ChCur)); 343Contracts.Assert(_sb.Length > 0); 365Contracts.Assert(_sb.Length > 0); 371Contracts.Assert(chSuf == '\0' || chSuf == 'D'); 466Contracts.Assert(ChCur == '"'); 492Contracts.Assert(ChCur == '"' || ChCur == '\''); 540Contracts.Assert(ChCur == '\\'); 636Contracts.Assert(u > 0x0000FFFF); 678Contracts.Assert(LexCharUtils.IsIdentStart(ChCur)); 705Contracts.Assert(LexCharUtils.IsIdent(ch)); 721Contracts.Assert(ChCur == '/'); 784Contracts.Assert(LexCharUtils.StartKind(ChCur) == LexStartKind.Space); 798Contracts.Assert(LexCharUtils.StartKind(ChCur) == LexStartKind.LineTerm);
Expression\MethodGenerator.cs (13)
24Contracts.CheckNonEmpty(name, nameof(name)); 25Contracts.CheckValue(thisType, nameof(thisType)); 26Contracts.AssertValueOrNull(returnType); 27Contracts.AssertValueOrNull(parameterTypes); 40Contracts.CheckValue(delegateType, nameof(delegateType)); 77Contracts.AssertValue(dispose); 78Contracts.AssertValue(localBuilder); 92Contracts.AssertValue(_dispose); 106Contracts.AssertValue(type); 144Contracts.CheckValue(type, nameof(type)); 145Contracts.Check(Il != null, "Cannot access IL for a method that has already been created"); 166Contracts.AssertValue(localBuilder); 175Contracts.Assert(!locals.Contains(localBuilder));
Expression\Node.cs (94)
171public override void PostVisit(LambdaNode node) { Contracts.Assert(false); } 172public override void PostVisit(UnaryOpNode node) { Contracts.Assert(false); } 173public override void PostVisit(BinaryOpNode node) { Contracts.Assert(false); } 174public override void PostVisit(ConditionalNode node) { Contracts.Assert(false); } 175public override void PostVisit(CompareNode node) { Contracts.Assert(false); } 176public override void PostVisit(CallNode node) { Contracts.Assert(false); } 177public override void PostVisit(ListNode node) { Contracts.Assert(false); } 178public override void PostVisit(WithNode node) { Contracts.Assert(false); } 179public override void PostVisit(WithLocalNode node) { Contracts.Assert(false); } 185public override void Visit(NameNode node) { Contracts.Assert(false); } 186public override void Visit(ParamNode node) { Contracts.Assert(false); } 188public override void PostVisit(LambdaNode node) { Contracts.Assert(false); } 198Contracts.AssertValue(tok); 209Contracts.Assert(false); 279Contracts.Assert(ExprType != 0); 315Contracts.Assert(tmp && kind == ExprType); 324Contracts.Assert(kind != 0); 325Contracts.Assert(ExprValue == null); 326Contracts.Assert(ExprType == 0 || ExprType == kind); 327Contracts.Assert(SrcKind == ExprType); 334Contracts.Assert(kind != 0); 335Contracts.Assert(value == null || value.GetType() == ToSysType(kind)); 336Contracts.Assert(ExprValue == null); 337Contracts.Assert(ExprType == 0 || ExprType == kind); 338Contracts.Assert(SrcKind == ExprType); 384Contracts.AssertValue(expr); 385Contracts.Assert(expr.ExprType != 0); 464Contracts.Assert(HasType); 469Contracts.Assert(SrcKind == ExprType); 473Contracts.Assert(ExprType == ExprTypeKind.I4); 476Contracts.Assert(ExprValue is I4); 481Contracts.Assert(ExprType == ExprTypeKind.I4); 484Contracts.Assert(ExprValue is I4); 489Contracts.Assert(ExprType == ExprTypeKind.I4 || ExprType == ExprTypeKind.I8 || 495Contracts.Assert(ExprValue is I4); 500Contracts.Assert(ExprValue is I8); 505Contracts.Assert(ExprValue is R4); 610Contracts.AssertNonEmpty(vars); 611Contracts.AssertValue(expr); 622Contracts.AssertValue(visitor); 653Contracts.AssertNonEmpty(name); 654Contracts.Assert(index >= 0); 655Contracts.AssertValueOrNull(type); 682Contracts.AssertValue(visitor); 696Contracts.AssertNonEmpty(tok.Value); 706Contracts.AssertValue(visitor); 723Contracts.AssertNonEmpty(tok.Value); 730Contracts.AssertNonEmpty(value); 741Contracts.AssertValue(visitor); 754Contracts.Assert(false); 775Contracts.Assert(tok.Kind == TokKind.IntLit); 804Contracts.AssertValue(visitor); 816Contracts.AssertValue(tok.Value); 827Contracts.AssertValue(visitor); 837Contracts.AssertValue(tok); 838Contracts.Assert(tok.Kind == TokKind.True || tok.Kind == TokKind.False); 850Contracts.AssertValue(visitor); 863Contracts.AssertValue(arg); 874Contracts.AssertValue(visitor); 895Contracts.AssertValue(left); 896Contracts.AssertValue(right); 908Contracts.AssertValue(visitor); 931Contracts.AssertValue(cond); 932Contracts.AssertValue(left); 933Contracts.AssertValueOrNull(tokColon); 934Contracts.AssertValue(right); 947Contracts.AssertValue(visitor); 967Contracts.AssertValue(items); 968Contracts.AssertValueOrNull(delimiters); 969Contracts.Assert(delimiters == null || delimiters.Length == items.Length - 1); 980Contracts.AssertValue(visitor); 985Contracts.AssertValue(item); 1009Contracts.AssertValue(head); 1010Contracts.AssertValue(args); 1011Contracts.AssertValueOrNull(tokClose); 1020Contracts.AssertValue(ns); 1021Contracts.AssertValue(dot); 1022Contracts.AssertValue(head); 1023Contracts.AssertValue(args); 1024Contracts.AssertValueOrNull(tokClose); 1038Contracts.AssertValue(visitor); 1057Contracts.Assert(argCount >= ps.Length - 1); 1058Contracts.Assert(meth.ReturnType != typeof(void)); 1061Contracts.Assert(Utils.Size(ps) == argCount); 1079Contracts.AssertValue(operands); 1080Contracts.Assert(operands.Items.Length >= 2); 1081Contracts.AssertValue(operands.Delimiters); 1082Contracts.Assert(operands.Delimiters.Length == operands.Items.Length - 1); 1089Contracts.Assert(false); 1116Contracts.AssertValue(visitor); 1143Contracts.AssertValue(local); 1144Contracts.AssertValue(body); 1186Contracts.AssertValue(name); 1187Contracts.AssertValue(value);
Expression\Printer.cs (27)
28Contracts.AssertValue(wrt); 38Contracts.AssertValue(node); 76Contracts.Assert(node is ExprNode); 100Contracts.Assert(false, "Unexpected node kind in GetPrec - should only see ExprNode kinds"); 125Contracts.Assert(false); 153Contracts.Assert(false); 167Contracts.Assert(false); 194Contracts.Assert(false); 214Contracts.AssertValue(node); 215Contracts.AssertValue(node.ExprValue); 239Contracts.Assert(false, "Unknown type"); 323Contracts.AssertValue(node); 330Contracts.AssertValue(node); 337Contracts.AssertValue(node); 344Contracts.AssertValue(node); 350Contracts.AssertValue(node); 360Contracts.AssertValue(node); 367Contracts.AssertValue(node); 388Contracts.AssertValue(node); 405Contracts.AssertValue(node); 435Contracts.AssertValue(node); 461Contracts.AssertValue(node); 486Contracts.Assert(tid == tidLax || tid == tidStrict); 495Contracts.AssertValue(node); 514Contracts.AssertValue(node); 548Contracts.AssertValue(node); 564Contracts.AssertValue(node);
Expression\TokenCursor.cs (16)
40Contracts.AssertValue(tokens); 57Contracts.AssertValue(_buffer); 60Contracts.Assert(0 <= _itokCur && _itokCur < _itokLim && _itokLim <= _buffer.Length); 63Contracts.Assert((_tokens != null) == (_buffer[_itokLim - 1].Kind != TokKind.Eof)); 66Contracts.Assert(_tokCur == _buffer[_itokCur]); 67Contracts.Assert(_tidCur == _tokCur.Kind); 102Contracts.Assert(_tokens != null); 134Contracts.Assert(_tokens != null); 135Contracts.Assert(_itokLim < _buffer.Length); 139Contracts.Assert(false, "Token stream should end with an Eof token!"); 140throw Contracts.Except(); 145Contracts.Assert(tok != null); 160Contracts.Assert(-_itokCur <= ditok && ditok <= _itokLim - _itokCur); 161Contracts.Assert(ditok < _itokLim - _itokCur || _tokens != null); 187Contracts.Assert(-_itokCur <= ditok && ditok <= _itokLim - _itokCur); 188Contracts.Assert(ditok < _itokLim - _itokCur || _tokens != null);
Expression\Tokens.cs (5)
19Contracts.Assert(0 <= ichMin && ichMin <= ichLim); 46Contracts.Assert(tidContext == tid || tid == TokKind.Ident); 54Contracts.Assert(this is T); 186Contracts.AssertNonEmpty(s); 223Contracts.AssertValue(str);
Expression\TokKind.cs (2)
165Contracts.Assert(false, "Unknown error id: " + eid); 174Contracts.Assert(carg == Utils.Size(args));
ExpressionTransformer.cs (6)
76Contracts.CheckValue(env, nameof(env)); 230Contracts.AssertNonEmpty(str); 240Contracts.AssertValue(sb); 306: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ExpressionTransformer))) 315Contracts.CheckValue(env, nameof(env)); 340Contracts.CheckValue(env, nameof(env));
FourierDistributionSampler.cs (16)
100Contracts.CheckParam(gamma > 0, nameof(gamma)); 106Contracts.CheckValueOrNull(env, nameof(env)); 119Contracts.Assert(averageDistance > 0); 142Contracts.Assert(gamma > 0); 143Contracts.Assert(averageDistance > 0); 149Contracts.CheckValue(env, nameof(env)); 157Contracts.AssertValue(env); 180Contracts.Assert(FloatUtils.IsFinite(_gamma)); 221Contracts.CheckParam(a > 0, nameof(a)); 227Contracts.CheckValue(env, nameof(env)); 240Contracts.Assert(averageDistance > 0); 264Contracts.Assert(a > 0); 265Contracts.Assert(averageDistance > 0); 271Contracts.CheckValue(env, nameof(env)); 280Contracts.AssertValue(env); 303Contracts.Assert(FloatUtils.IsFinite(_a));
GcnTransform.cs (27)
81Contracts.AssertValue(sb); 95Contracts.AssertNonEmpty(str); 105Contracts.AssertValue(sb); 122Contracts.AssertNonEmpty(str); 132Contracts.AssertValue(sb); 191Contracts.CheckValue(columns, nameof(columns)); 205base(Contracts.CheckRef(env, nameof(env)).Register(nameof(LpNormNormalizingTransformer)), GetColumnPairs(columns)) 213Contracts.CheckValue(env, nameof(env)); 240Contracts.CheckValue(env, nameof(env)); 264Contracts.CheckValue(env, nameof(env)); 362Contracts.AssertValue(input); 363Contracts.Assert(0 <= iinfo && iinfo < _parent.ColumnPairs.Length); 529Contracts.Assert(0 <= values.Length && values.Length <= length); 551Contracts.Assert(0 <= values.Length && values.Length <= length); 725Contracts.Assert(false); 822Contracts.CheckNonWhiteSpace(name, nameof(name)); 823Contracts.CheckNonWhiteSpace(inputColumnName, nameof(inputColumnName)); 827Contracts.CheckUserArg(0 < scale && scale < float.PositiveInfinity, nameof(scale), "scale must be a positive finite value"); 834Contracts.AssertValue(ctx); 835Contracts.CheckNonWhiteSpace(inputColumnName, nameof(inputColumnName)); 836Contracts.CheckNonWhiteSpace(name, nameof(name)); 846Contracts.CheckDecode(Enum.IsDefined(typeof(NormFunction), normKindVal)); 852Contracts.CheckDecode(normKindSerialized || 855Contracts.CheckDecode(0 < Scale && Scale < float.PositiveInfinity); 860Contracts.AssertValue(ctx); 867Contracts.Assert(0 < Scale && Scale < float.PositiveInfinity); 886: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(LpNormNormalizingEstimator)), new LpNormNormalizingTransformer(env, columns))
GroupTransform.cs (12)
121Contracts.CheckValue(env, nameof(env)); 219Contracts.AssertValue(ectx); 238Contracts.AssertValue(env); 343Contracts.AssertValue(schema); 344Contracts.AssertValue(names); 417Contracts.Check(result = false, "Invalid type."); 428Contracts.AssertValue(row); 450Contracts.AssertValue(row); 452Contracts.Assert(colType is PrimitiveDataViewType); 469Contracts.AssertValue(row); 495Contracts.Assert(0 <= position && position < _size); 674Contracts.CheckValue(env, nameof(env));
HashJoiningTransform.cs (6)
98Contracts.AssertValue(sb); 129Contracts.CheckValueOrNull(slotMap); 130Contracts.Check(NumBitsMin <= numberOfBits && numberOfBits < NumBitsLim); 199: base(env, RegistrationName, Contracts.CheckRef(args, nameof(args)).Columns, input, TestColumnType) 279Contracts.CheckValue(env, nameof(env)); 668Contracts.CheckValue(env, nameof(env));
KeyToVectorMapping.cs (9)
80: base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), columns) 99Contracts.CheckValue(env, nameof(env)); 119Contracts.CheckValue(env, nameof(env)); 315Contracts.Assert(slot == (long)kvpSlot.Key * _bitsPerKey[iinfo]); 374Contracts.Assert(dst.Length == bitsPerKey); 411Contracts.Assert(dst.Length == src.Length * bitsPerKey); 417Contracts.Assert(0 < bitsToConsider && bitsToConsider <= sizeof(uint) * 8); 418Contracts.Assert(startIndex >= 0); 459: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(KeyToBinaryVectorMappingEstimator)), transformer)
LambdaTransform.cs (3)
58Contracts.CheckValue(env, nameof(env)); 105Contracts.CheckValue(env, nameof(env)); 144Contracts.CheckValue(env, nameof(env));
LearnerFeatureSelection.cs (11)
89Contracts.CheckValue(env, nameof(env)); 121Contracts.Assert(options.Threshold.HasValue != options.NumSlotsToKeep.HasValue); 140Contracts.Assert(options.NumSlotsToKeep.HasValue); 188Contracts.Assert(range.max != null); 191Contracts.Assert(min <= max); 192Contracts.Assert(max < scoresValues.Length); 245Contracts.Assert(heap.Count == topk); 258Contracts.Assert(top >= threshold); 268Contracts.AssertValue(host); 298Contracts.AssertValue(rfs); 308Contracts.CheckValue(env, nameof(env));
LoadTransform.cs (1)
67Contracts.CheckValue(env, nameof(env));
MetricStatistics.cs (1)
58Contracts.Assert(src.Count == dest.Count);
MissingValueDroppingTransformer.cs (8)
34: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(MissingValueDroppingEstimator)), new MissingValueDroppingTransformer(env, columns)) 79Contracts.AssertValue(sb); 113: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(MissingValueDroppingTransformer)), columns) 118: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(MissingValueDroppingTransformer)), GetColumnPairs(options.Columns)) 123: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(MissingValueDroppingTransformer)), ctx) 141Contracts.CheckValue(env, nameof(env)); 219Contracts.AssertValue(input); 220Contracts.Assert(0 <= iinfo && iinfo < _parent.ColumnPairs.Length);
MissingValueHandlingTransformer.cs (2)
98Contracts.AssertValue(sb); 135Contracts.CheckValue(env, nameof(env));
MissingValueIndicatorTransform.cs (4)
28Contracts.AssertNonEmpty(str); 38Contracts.AssertValue(sb); 76: base(env, RegistrationName, Contracts.CheckRef(args, nameof(args)).Columns, 100Contracts.CheckValue(env, nameof(env));
MissingValueIndicatorTransformer.cs (8)
40Contracts.AssertNonEmpty(str); 50Contracts.AssertValue(sb); 92: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(MissingValueIndicatorTransformer)), columns) 97: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(MissingValueIndicatorTransformer)), GetColumnPairs(options.Columns)) 102: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(MissingValueIndicatorTransformer)), ctx) 113Contracts.CheckValue(env, nameof(env)); 514: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(MissingValueIndicatorTransformer)), new MissingValueIndicatorTransformer(env, columns)) 516Contracts.CheckValue(env, nameof(env));
MissingValueReplacing.cs (9)
106Contracts.AssertValue(sb); 165Contracts.Assert(type.GetItemType().RawType == typeof(T)); 183Contracts.CheckValue(columns, nameof(columns)); 211: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(MissingValueReplacingTransformer)), GetColumnPairs(columns)) 422throw Contracts.Except("No conversion of '{0}' to '{1}'", srcStr, dstType.GetItemType()); 431Contracts.CheckValue(env, nameof(env)); 462Contracts.CheckValue(env, nameof(env)); 995Contracts.CheckNonWhiteSpace(name, nameof(name)); 1025Contracts.CheckValue(env, nameof(env));
MissingValueReplacingUtils.cs (15)
154Contracts.AssertValue(ch); 430Contracts.Assert(double.MinValue <= _cur && _cur <= double.MaxValue); 449Contracts.Assert(double.MinValue <= _cur && _cur <= double.MaxValue); 454Contracts.Assert(double.MinValue <= _cur && _cur <= double.MaxValue); 455Contracts.Assert(_cnz >= 0 && _cna >= 0); 456Contracts.Assert(count >= _cna); 457Contracts.Assert(count - _cna >= _cnz); 468Contracts.Assert(double.MinValue <= stat && stat <= double.MaxValue); 474Contracts.Assert(double.MinValue <= _cur && _cur <= double.MaxValue); 475Contracts.Assert(_cnz >= 0 && _cna >= 0); 476Contracts.Assert(count.High != 0 || count.Low >= (ulong)_cna); 488Contracts.Assert(double.MinValue <= stat && stat <= double.MaxValue); 510Contracts.Assert(valMax > 0 && ((valMax + 1) & valMax) == 0); 511Contracts.Assert(_cna >= 0); 517Contracts.Assert(!val.HasValue || -valMax <= val && val <= valMax);
MutualInformationFeatureSelection.cs (31)
132Contracts.CheckValue(env, nameof(env)); 260Contracts.CheckValue(env, nameof(env)); 292Contracts.Assert(score >= 0); 300Contracts.Assert(heap.Count == topk); 314Contracts.Assert(top >= threshold); 325Contracts.Assert(size > 0); 326Contracts.Assert(Utils.Size(scores) == size); 327Contracts.Assert(Utils.Size(cols) == size); 328Contracts.Assert(threshold > 0 || (threshold == 0 && tiedScoresToKeep == 0)); 429Contracts.AssertValue(host); 492Contracts.Assert(b); 501Contracts.Assert(b); 554Contracts.Assert(labelKeyCount < Utils.ArrayMaxSize); 567Contracts.Assert(labels.IsDense); 572Contracts.Assert(labelsEditor.Values[i] < _numLabels); 632Contracts.Assert(keyCount < Utils.ArrayMaxSize); 646Contracts.Assert(0 < keyCount && keyCount < Utils.ArrayMaxSize); 674Contracts.Assert(iScore < slotCount); 686Contracts.Assert(_labels.Length == features.Length); 718Contracts.Assert(score >= 0); 727Contracts.Assert(_labels.IsDense); 728Contracts.Assert(_labels.Length == features.Length); 737Contracts.Assert(0 <= label && label < _numLabels); 738Contracts.Assert(0 <= feature && feature < numFeatures); 757Contracts.Assert(0 <= label && label < _numLabels); 758Contracts.Assert(0 <= feature && feature < numFeatures); 761Contracts.Assert(ii == featureIndices.Length); 798Contracts.Assert(_singles.Count == 0); 817Contracts.Assert(_singles.Count == 0); 843Contracts.Assert(_doubles.Count == 0); 886Contracts.Assert(tmpDst.Equals(default(TDst)));
OneHotEncoding.cs (8)
45Contracts.AssertNonEmpty(str); 61Contracts.AssertValue(sb); 96Contracts.CheckValue(env, nameof(env)); 280Contracts.CheckValue(env, nameof(env)); 355Contracts.CheckValue(env, nameof(env)); 369Contracts.CheckValue(env, nameof(env)); 383Contracts.CheckValue(env, nameof(env)); 397Contracts.CheckValue(env, nameof(env));
OneHotHashEncoding.cs (5)
49Contracts.AssertNonEmpty(str); 59Contracts.AssertNonEmpty(str); 75Contracts.AssertValue(sb); 145Contracts.CheckValue(env, nameof(env)); 326Contracts.CheckValue(env, nameof(env));
OptionalColumnTransform.cs (14)
58Contracts.AssertValue(parent); 59Contracts.Assert(Utils.Size(columnTypes) == InfoCount); 60Contracts.Assert(Utils.Size(srcCols) == InfoCount); 61Contracts.AssertValue(inputWithOptionalColumn); 81Contracts.CheckUserArg(success, nameof(args.Columns)); 91Contracts.AssertValue(ctx); 92Contracts.AssertValue(input); 109Contracts.CheckDecode(size > 0); 134Contracts.AssertValue(ctx); 182Contracts.Assert(0 <= iinfo && iinfo < InfoCount); 203Contracts.AssertValue(predicate); 206Contracts.Assert(active.Length == Input.Count); 222Contracts.AssertValue(dependingColumns); 296Contracts.CheckValue(env, nameof(env));
PermutationFeatureImportance.cs (3)
33Contracts.CheckValue(env, nameof(env)); 187Contracts.Assert(input.Count == 1); 191Contracts.Assert(output.Count == 1);
PermutationFeatureImportanceExtensions.cs (10)
137Contracts.CheckValue(catalog, nameof(catalog)); 140Contracts.CheckValue(env, nameof(env)); 287Contracts.CheckValue(catalog, nameof(catalog)); 290Contracts.CheckValue(env, nameof(env)); 441Contracts.CheckValue(catalog, nameof(catalog)); 444Contracts.CheckValue(env, nameof(env)); 469Contracts.Assert(a.TopKPredictionCount == b.TopKPredictionCount, "TopK to compare must be the same length."); 604Contracts.CheckValue(catalog, nameof(catalog)); 607Contracts.CheckValue(env, nameof(env)); 643Contracts.Assert(a.Count == b.Count);
ProduceIdTransform.cs (8)
42Contracts.Assert(InfoCount == 1); 47Contracts.Assert(iinfo == 0); 53Contracts.AssertValue(ctx); 54Contracts.AssertValue(input); 64Contracts.AssertValue(ctx); 73Contracts.AssertValue(predicate); 76Contracts.Assert(active.Length == Input.Count); 121Contracts.CheckValue(env, nameof(env));
RandomFourierFeaturizing.cs (16)
74Contracts.AssertNonEmpty(str); 84Contracts.AssertValue(sb); 109Contracts.AssertValue(host); 165Contracts.AssertValue(ctx); 183Contracts.Assert(rowSize >= SrcDim); 238Contracts.CheckValue(columns, nameof(columns)); 254: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ApproximatedKernelTransformer)), GetColumnPairs(columns)) 270Contracts.Assert(0 < cflt); 272Contracts.Assert(0 < cfltAlign && (cfltAlign & (cfltAlign - 1)) == 0); 342Contracts.Assert(resLength == instanceCount); 412Contracts.CheckValue(env, nameof(env)); 440Contracts.CheckValue(env, nameof(env)); 504Contracts.AssertValue(input); 505Contracts.Assert(0 <= iinfo && iinfo < _parent.ColumnPairs.Length); 680Contracts.CheckUserArg(rank > 0, nameof(rank), "must be positive."); 708Contracts.CheckValue(env, nameof(env));
StatefulCustomMappingTransformer.cs (4)
50Contracts.CheckValue(env, nameof(env)); 377: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(StatefulCustomMappingEstimator<TSrc, TDst, TState>)), 396throw Contracts.ExceptSchemaMismatch(nameof(inputSchema), "input", col.ColumnName); 405throw Contracts.ExceptSchemaMismatch(nameof(inputSchema), "input", col.ColumnName, col.ColumnType.ToString(), column.GetTypeString());
StatefulFilterTransform.cs (4)
117Contracts.CheckParam(n >= 0, nameof(n)); 118Contracts.CheckValueOrNull(rand); 218Contracts.CheckParam(column.Index < Schema.Count, nameof(column)); 235Contracts.CheckParam(column.Index < Schema.Count, nameof(column));
SvmLight\SvmLightLoader.cs (10)
163Contracts.Assert(notEmpty); 313throw Contracts.Except("Encountered 0 index while parsing a 1-based dataset"); 318throw Contracts.Except($"Encountered non-parsable index '{inputValues[i]}' while parsing dataset"); 351Contracts.Assert(keyCount > 0); 366Contracts.Check(keys.Length == values.Length, "number of keys does not match number of values."); 383throw Contracts.Except("Duplicate keys found in dataset"); 406Contracts.CheckValue(env, nameof(env)); 554Contracts.CheckValue(env, nameof(env)); 594Contracts.AssertValue(host, "host"); 612Contracts.CheckValue(env, nameof(env));
SvmLight\SvmLightLoaderSaverCatalog.cs (4)
71Contracts.CheckNonEmpty(path, nameof(path)); 74throw Contracts.ExceptParam(nameof(path), "File does not exist at path: {0}", path); 93Contracts.CheckNonEmpty(path, nameof(path)); 96throw Contracts.ExceptParam(nameof(path), "File does not exist at path: {0}", path);
SvmLight\SvmLightSaver.cs (1)
65Contracts.CheckValue(env, nameof(env));
Text\LdaSingleBox.cs (24)
138Contracts.Check(numTopic >= 0); 139Contracts.Check(numVocab >= 0); 140Contracts.Check(tableSize >= 0); 141Contracts.Check(aliasTableSize >= 0); 147Contracts.Check(docNum >= 0); 148Contracts.Check(corpusSize >= 0); 167Contracts.Check(numBurninIter >= 0); 197Contracts.Check(numVocab == NumVocab); 198Contracts.Check(termNum > 0); 199Contracts.Check(termID.Length >= termNum); 200Contracts.Check(termVal.Length >= termNum); 212Contracts.Check(numVocab == NumVocab); 213Contracts.Check(termNum > 0); 215Contracts.Check(termVal.Length >= termNum); 263Contracts.Check(termNum > 0); 264Contracts.Check(termVal.Length >= termNum); 265Contracts.Check(termID.Length >= termNum); 282Contracts.Check(false); 294Contracts.Check(termNum > 0); 295Contracts.Check(numBurninIter > 0); 296Contracts.Check(termVal.Length >= termNum); 315Contracts.Check(false); 359Contracts.Check(termID >= 0); 360Contracts.Check(topicNum <= NumTopic);
Text\LdaTransform.cs (30)
149Contracts.AssertNonEmpty(str); 159Contracts.AssertValue(sb); 219Contracts.Assert(0 <= columnIndex && columnIndex < _ldas.Length); 245Contracts.AssertValue(ectx); 375Contracts.AssertValue(ctx); 417Contracts.AssertValue(ectx); 525Contracts.Assert(count <= len); 533Contracts.Assert(value >= 0); 534Contracts.Assert(0 <= index && index < len); 537Contracts.Assert(i == 0 || editor.Indices[i - 1] < index); 541Contracts.Assert(index == i); 598Contracts.AssertValue(input); 599Contracts.Assert(0 <= iinfo && iinfo < _parent.ColumnPairs.Length); 647Contracts.CheckValue(columns, nameof(columns)); 662: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(LatentDirichletAllocationTransformer)), GetColumnPairs(columns)) 723Contracts.CheckValue(env, nameof(env)); 735Contracts.CheckValue(env, nameof(env)); 1091Contracts.CheckValue(env, nameof(env)); 1191Contracts.CheckValue(name, nameof(name)); 1192Contracts.CheckValueOrNull(inputColumnName); 1193Contracts.CheckParam(numberOfTopics > 0, nameof(numberOfTopics), "Must be positive."); 1194Contracts.CheckParam(samplingStepCount > 0, nameof(samplingStepCount), "Must be positive."); 1195Contracts.CheckParam(maximumNumberOfIterations > 0, nameof(maximumNumberOfIterations), "Must be positive."); 1196Contracts.CheckParam(likelihoodInterval > 0, nameof(likelihoodInterval), "Must be positive."); 1197Contracts.CheckParam(numberOfThreads >= 0, nameof(numberOfThreads), "Must be positive or zero."); 1198Contracts.CheckParam(maximumTokenCountPerDocument > 0, nameof(maximumTokenCountPerDocument), "Must be positive."); 1199Contracts.CheckParam(numberOfSummaryTermsPerTopic > 0, nameof(numberOfSummaryTermsPerTopic), "Must be positive"); 1200Contracts.CheckParam(numberOfBurninIterations >= 0, nameof(numberOfBurninIterations), "Must be non-negative."); 1238Contracts.AssertValue(ectx); 1287Contracts.AssertValue(ctx);
Text\NgramHashingTransformer.cs (59)
69Contracts.AssertNonEmpty(str); 79Contracts.AssertNonEmpty(str); 96Contracts.AssertValue(sb); 181base(Contracts.CheckRef(env, nameof(env)).Register(nameof(NgramHashingTransformer))) 192base(Contracts.CheckRef(env, nameof(env)).Register(nameof(NgramHashingTransformer))) 194Contracts.CheckValue(columns, nameof(columns)); 278base(Contracts.CheckRef(env, nameof(env)).Register(nameof(NgramHashingTransformer))) 287Contracts.CheckDecode(columnsLength > 0); 312Contracts.CheckDecode(csrc > 0); 334Contracts.CheckValue(env, nameof(env)); 366Contracts.CheckValue(env, nameof(env)); 383base(Contracts.CheckRef(parent, nameof(parent)).Host.Register(nameof(Mapper)), inputSchema, parent) 648Contracts.AssertValue(parent); 649Contracts.AssertValue(friendlyNames); 650Contracts.Assert(friendlyNames.Length == parent._columns.Length); 651Contracts.AssertValue(columnsNeeded); 652Contracts.AssertValue(invertHashMaxCounts); 653Contracts.Assert(invertHashMaxCounts.Length == parent._columns.Length); 663Contracts.Assert(col.Index < _srcTextGetters.Length); 693Contracts.AssertValue(ngram); 694Contracts.Assert(1 <= lim && lim <= ngram.Length); 695Contracts.Assert(0 <= srcCol); 748Contracts.Assert(0 <= iinfo && iinfo < _parent._columns.Length); 749Contracts.Assert(_iinfoToCollector[iinfo] == null); 750Contracts.AssertValue(finder); 764Contracts.AssertValue(srcMap); 769Contracts.Assert(src.ISrcCol == 0); 787Contracts.Assert(srcIndices.Length > 1); 795Contracts.Assert(Utils.Size(srcNames) == srcIndices.Length); 803Contracts.AssertValue(srcMap); 824Contracts.Assert(0 <= icol && icol < srcIndices.Length); 825Contracts.AssertValue(_srcTextGetters[srcIndices[icol]]); 851Contracts.Assert(vec.Length == 1 << _parent._columns[iinfo].NumberOfBits); 952Contracts.CheckValue(name, nameof(name)); 953Contracts.CheckValue(inputColumnNames, nameof(inputColumnNames)); 954Contracts.CheckParam(!inputColumnNames.Any(r => string.IsNullOrWhiteSpace(r)), nameof(inputColumnNames), 957throw Contracts.ExceptParam(nameof(maximumNumberOfInverts), "Value too small, must be -1 or larger"); 961throw Contracts.ExceptParam(nameof(numberOfBits), $"Cannot support maximumNumberOfInverts for a {0} bit hash. 30 is the maximum possible.", numberOfBits); 964throw Contracts.ExceptUserArg(nameof(skipLength), string.Format( 968throw Contracts.ExceptUserArg(nameof(skipLength), 987Contracts.AssertValue(ctx); 1006Contracts.CheckDecode(0 < NgramLength && NgramLength <= NgramBufferBuilder.MaxSkipNgramLength); 1008Contracts.CheckDecode(0 <= SkipLength && SkipLength <= NgramBufferBuilder.MaxSkipNgramLength); 1009Contracts.CheckDecode(SkipLength <= NgramBufferBuilder.MaxSkipNgramLength - NgramLength); 1011Contracts.CheckDecode(1 <= NumberOfBits && NumberOfBits <= 30); 1020Contracts.AssertValue(ctx); 1021Contracts.CheckValue(inputColumnNames, nameof(inputColumnNames)); 1022Contracts.CheckParam(!inputColumnNames.Any(r => string.IsNullOrWhiteSpace(r)), nameof(inputColumnNames), 1036Contracts.CheckDecode(0 < NgramLength && NgramLength <= NgramBufferBuilder.MaxSkipNgramLength); 1038Contracts.CheckDecode(0 <= SkipLength && SkipLength <= NgramBufferBuilder.MaxSkipNgramLength); 1039Contracts.CheckDecode(SkipLength <= NgramBufferBuilder.MaxSkipNgramLength - NgramLength); 1041Contracts.CheckDecode(1 <= NumberOfBits && NumberOfBits <= 30); 1050Contracts.AssertValue(ctx); 1063Contracts.Assert(InputColumnNamesArray.Length > 0); 1069Contracts.Assert(0 < NgramLength && NgramLength <= NgramBufferBuilder.MaxSkipNgramLength); 1071Contracts.Assert(0 <= SkipLength && SkipLength <= NgramBufferBuilder.MaxSkipNgramLength); 1072Contracts.Assert(NgramLength + SkipLength <= NgramBufferBuilder.MaxSkipNgramLength); 1074Contracts.Assert(1 <= NumberOfBits && NumberOfBits <= 30); 1177Contracts.CheckValue(env, nameof(env));
Text\NgramTransform.cs (27)
60Contracts.AssertNonEmpty(str); 70Contracts.AssertValue(sb); 144Contracts.AssertValue(ctx); 153Contracts.CheckDecode(0 < NgramLength && NgramLength <= NgramBufferBuilder.MaxSkipNgramLength); 155Contracts.CheckDecode(0 <= SkipLength && SkipLength <= NgramBufferBuilder.MaxSkipNgramLength); 156Contracts.CheckDecode(NgramLength <= NgramBufferBuilder.MaxSkipNgramLength - SkipLength); 160Contracts.CheckDecode(Enum.IsDefined(typeof(NgramExtractingEstimator.WeightingCriteria), Weighting)); 166Contracts.AssertValue(ctx); 174Contracts.Assert(0 < NgramLength && NgramLength <= NgramBufferBuilder.MaxSkipNgramLength); 176Contracts.Assert(0 <= SkipLength && SkipLength <= NgramBufferBuilder.MaxSkipNgramLength); 177Contracts.Assert(NgramLength + SkipLength <= NgramBufferBuilder.MaxSkipNgramLength); 179Contracts.Assert(Enum.IsDefined(typeof(NgramExtractingEstimator.WeightingCriteria), Weighting)); 181Contracts.Assert(Utils.Size(NonEmptyLevels) == NgramLength); 196Contracts.CheckValue(columns, nameof(columns)); 208: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(NgramExtractingTransformer)), GetColumnPairs(columns)) 340Contracts.AssertValue(env); 411Contracts.CheckValue(env, nameof(env)); 440Contracts.CheckValue(env, nameof(env)); 672Contracts.AssertValue(input); 673Contracts.Assert(0 <= iinfo && iinfo < _parent.ColumnPairs.Length); 948Contracts.CheckValue(env, nameof(env)); 1041throw Contracts.ExceptUserArg(nameof(skipLength), string.Format( 1044throw Contracts.ExceptUserArg(nameof(skipLength), 1046Contracts.CheckUserArg(0 < ngramLength && ngramLength <= NgramBufferBuilder.MaxSkipNgramLength, nameof(ngramLength)); 1051Contracts.CheckUserArg(Utils.Size(maximumNgramsCounts) == 0 || 1057Contracts.CheckUserArg(Utils.Size(maximumNgramsCounts) <= ngramLength, nameof(maximumNgramsCounts)); 1058Contracts.CheckUserArg(Utils.Size(maximumNgramsCounts) == 0 || maximumNgramsCounts.All(i => i >= 0) && maximumNgramsCounts[maximumNgramsCounts.Length - 1] > 0, nameof(maximumNgramsCounts));
Text\NgramUtils.cs (17)
49Contracts.Assert(ngramLength > 0); 50Contracts.Assert(skipLength >= 0); 51Contracts.Assert(ngramLength <= MaxSkipNgramLength - skipLength); 52Contracts.Assert(slotLim >= 0); 72Contracts.Assert(icol >= 0); 73Contracts.Assert(keyMax > 0); 141Contracts.Assert(_queue.Count > 0); 149Contracts.Assert(0 <= slot && slot < _slotLim); 162Contracts.Assert(more); 165Contracts.Assert(0 <= slot && slot < _slotLim); 181Contracts.Assert(0 < i && i < _ngramLength); 182Contracts.Assert(0 <= skips && skips <= _skipLength); 183Contracts.Assert(i + skips < _queue.Count); 184Contracts.Assert(i > 1 || skips == 0); 185Contracts.Assert(_ngram.Length == _ngramLength); 192Contracts.Assert(more); 195Contracts.Assert(0 <= slot && slot < _slotLim);
Text\SentimentAnalyzingTransform.cs (1)
54Contracts.CheckValue(env, nameof(env));
Text\StopWordsRemovingTransformer.cs (22)
81Contracts.AssertNonEmpty(str); 91Contracts.AssertValue(sb); 152Contracts.Assert(langValues.Min() >= 0); 153Contracts.Assert(maxValue < Utils.ArrayMaxSize); 183Contracts.CheckValue(columns, nameof(columns)); 200base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), GetColumnPairs(columns)) 237Contracts.CheckDecode(Enum.IsDefined(typeof(StopWordsRemovingEstimator.Language), lang)); 246Contracts.CheckValue(env, nameof(env)); 256Contracts.CheckValue(env, nameof(env)); 321Contracts.Assert(0 <= (int)lang && (int)lang < Utils.Size(StopWords)); 326Contracts.Assert(stopWordsStream != null); 358: base(Contracts.CheckRef(parent, nameof(parent)).Host.Register(nameof(Mapper)), inputSchema, parent) 501Contracts.Assert(0 <= langVal && langVal < Utils.Size(StopWords)); 591Contracts.CheckNonWhiteSpace(name, nameof(name)); 661: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(StopWordsRemovingEstimator)), new StopWordsRemovingTransformer(env, columns)) 702Contracts.AssertValue(sb); 910base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), columns) 929base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), columns) 1022Contracts.CheckValue(env, nameof(env)); 1032Contracts.CheckValue(env, nameof(env)); 1069: base(Contracts.CheckRef(parent, nameof(parent)).Host.Register(nameof(Mapper)), parent, inputSchema) 1229base(Contracts.CheckRef(env, nameof(env)).Register(nameof(CustomStopWordsRemovingEstimator)), new CustomStopWordsRemovingTransformer(env, stopwords, columns))
Text\TextCatalog.cs (21)
39=> new TextFeaturizingEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), 65=> new TextFeaturizingEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), 93=> new TokenizingByCharactersEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), 141=> new TextNormalizingEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), 166=> new WordEmbeddingEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), outputColumnName, inputColumnName, modelKind); 190=> new WordEmbeddingEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), 211=> new WordEmbeddingEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), modelKind, columns); 233=> new WordTokenizingEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), outputColumnName, inputColumnName, separators); 243=> new WordTokenizingEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), columns); 276new NgramExtractingEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), outputColumnName, inputColumnName, 288=> new NgramExtractingEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), columns); 311=> new StopWordsRemovingEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), outputColumnName, inputColumnName, language); 334=> new CustomStopWordsRemovingEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), outputColumnName, inputColumnName, stopwords); 362=> new WordBagEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), 387=> new WordBagEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), 416=> new WordBagEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), 452=> new WordHashBagEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), 490=> new WordHashBagEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), 530=> new NgramHashingEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), 576=> new NgramHashingEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), 592=> new NgramHashingEstimator(Contracts.CheckRef(catalog, nameof(catalog)).GetEnvironment(), columns);
Text\TextFeaturizingEstimator.cs (10)
118Contracts.AssertValue(sb); 335Contracts.Assert(false, "Unexpected normalizer type"); 416Contracts.CheckValue(env, nameof(env)); 498Contracts.Assert(wordTokCols != null, "StopWords transform requires that word tokenization has been applied to the input text."); 598Contracts.Assert(charFeatureCol != null || wordFeatureCol != null || !string.IsNullOrEmpty(tparams.OutputTextTokensColumnName)); 617Contracts.AssertValue(chain); 618Contracts.AssertValue(transformer); 619Contracts.AssertValue(view); 690Contracts.AssertValue(env); 727Contracts.CheckValue(env, nameof(env));
Text\TextNormalizing.cs (6)
49Contracts.AssertValue(sb); 107base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), columns) 146Contracts.CheckValue(env, nameof(env)); 174Contracts.CheckValue(env, nameof(env)); 314Contracts.Assert(_combinedDiacriticsPairs[i].Length == 2); 569: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(TextNormalizingEstimator)),
Text\TokenizingByCharacters.cs (9)
49Contracts.AssertValue(sb); 110base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), columns) 158Contracts.CheckValue(env, nameof(env)); 168Contracts.CheckValue(env, nameof(env)); 497Contracts.Assert(index == len); 509Contracts.Assert(cv >= 0); 546Contracts.Assert(index == len); 603Contracts.Assert(index == len); 674: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(TokenizingByCharactersEstimator)), new TokenizingByCharactersTransformer(env, useMarkerCharacters, columns))
Text\WordBagTransform.cs (17)
79Contracts.AssertNonEmpty(str); 89Contracts.AssertValue(sb); 112Contracts.CheckValue(env, nameof(env)); 183: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(TextExpandingEstimator)), new TextExpandingTransformer(env, columnName, freqSeparator, termSeparator)) 214: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(TextExpandingTransformer))) 236base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ColumnConcatenatingTransformer))) 383Contracts.AssertNonEmpty(str); 393Contracts.AssertValue(sb); 459Contracts.CheckValue(env, nameof(env)); 544Contracts.CheckValue(env, nameof(env)); 554Contracts.Check(Utils.Size(cols[i].Source) == 1, "too many source columns"); 573Contracts.CheckValue(env, nameof(env)); 641Contracts.CheckValue(extractorArgs, nameof(extractorArgs)); 642Contracts.CheckValueOrNull(termLoaderArgs); 665Contracts.CheckValue(extractorArgs, nameof(extractorArgs)); 679Contracts.CheckValue(env, nameof(env)); 701Contracts.CheckValue(env, nameof(env));
Text\WordEmbeddingsExtractor.cs (10)
44Contracts.AssertNonEmpty(str); 54Contracts.AssertValue(sb); 185: base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), GetColumnPairs(columns)) 201: base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), GetColumnPairs(columns)) 214Contracts.CheckValue(columns, nameof(columns)); 221Contracts.CheckValue(env, nameof(env)); 270Contracts.CheckValue(env, nameof(env)); 814Contracts.CheckValue(env, nameof(env)); 823Contracts.CheckValue(env, nameof(env)); 919Contracts.CheckNonEmpty(name, nameof(name));
Text\WordHashBagProducingTransform.cs (12)
32Contracts.AssertNonEmpty(str); 42Contracts.AssertNonEmpty(str); 61Contracts.AssertValue(sb); 88Contracts.CheckValue(env, nameof(env)); 103Contracts.Assert(uniqueSourceNames.Length == options.Columns.Length); 114Contracts.Assert(uniqueSourceNames[iinfo].Length == options.Columns[iinfo].Source.Length); 209Contracts.AssertNonEmpty(str); 219Contracts.AssertNonEmpty(str); 238Contracts.AssertValue(sb); 324Contracts.CheckValue(env, nameof(env)); 381Contracts.CheckValue(env, nameof(env)); 418Contracts.CheckValue(env, nameof(env));
Text\WordTokenizing.cs (12)
49Contracts.AssertNonEmpty(str); 59Contracts.AssertValue(sb); 112Contracts.CheckNonEmpty(columns, nameof(columns)); 117base(Contracts.CheckRef(env, nameof(env)).Register(RegistrationName), GetColumnPairs(columns)) 141Contracts.CheckDecode(Utils.Size(separators) > 0); 168Contracts.CheckValue(env, nameof(env)); 178Contracts.CheckValue(env, nameof(env)); 280Contracts.Assert(cv >= 0); 364Contracts.AssertValue(ctx); 365Contracts.AssertValue(srcToken); 366Contracts.Assert(CanSavePfa); 489: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(WordTokenizingEstimator)), new WordTokenizingTransformer(env, columns))
Text\WrappedTextTransformers.cs (2)
171Contracts.CheckValue(env, nameof(env)); 355Contracts.CheckValue(env, nameof(env));
UngroupTransform.cs (10)
122Contracts.CheckValue(env, nameof(env)); 229Contracts.AssertNonEmpty(name); 230Contracts.Assert(index >= 0); 231Contracts.Assert(size >= 0); 232Contracts.AssertValue(itemType); 272Contracts.AssertValueOrNull(ectx); 323Contracts.AssertValueOrNull(ectx); 345Contracts.AssertValueOrNull(ectx); 580Contracts.Assert(0 <= col && col < _ungroupBinding.InputColumnCount); 683Contracts.CheckValue(env, nameof(env));
Microsoft.ML.Vision (28)
DnnRetrainTransform.cs (9)
91Contracts.CheckValue(env, nameof(env)); 157Contracts.CheckValue(env, nameof(env)); 175Contracts.CheckValue(env, nameof(env)); 524: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(DnnRetrainTransformer))) 766base(Contracts.CheckRef(parent, nameof(parent)).Host.Register(nameof(Mapper)), inputSchema, parent) 811throw Contracts.Except($"Input shape mismatch: Input '{_parent._inputs[i]}' has shape {originalShape.ToString()}, but input data is of length {typeValueCount}."); 818throw Contracts.Except($"Input shape mismatch: Input '{_parent._inputs[i]}' has shape {originalShape.ToString()}, but input data is of length {typeValueCount}."); 937Contracts.Assert(tensors.Length > 0); 1230_host = Contracts.CheckRef(env, nameof(env)).Register(nameof(DnnRetrainEstimator));
ImageClassificationTrainer.cs (18)
526: base(Contracts.CheckRef(env, nameof(env)).Register(LoadName), 610Contracts.CheckParam(labelCount > 1, nameof(labelCount), msg); 635Contracts.Assert(success); 714Contracts.Assert(!generateValidationSet, "Validation set needed but cannot generate."); 852Contracts.Assert(validationFraction >= 0 && validationFraction <= 1); 868Contracts.Assert(examples == featurizedImages.Count()); 869Contracts.Assert(featurizedImages.All(x => x.Item2.Length == featureLength)); 901Contracts.Assert(validationSetBottleneckFilePath == null || 905Contracts.Assert(trainBottleneckFilePath != null && 911Contracts.Assert(_options.EarlyStoppingCriteria == null || validationNeeded); 1087Contracts.Assert(labelFileBytesRead <= labelBufferSizeInBytes); 1088Contracts.Assert(featuresFileBytesRead <= featureBufferSizeInBytes); 1089Contracts.Assert(labelFileBytesRead % sizeof(long) == 0); 1090Contracts.Assert(featuresFileBytesRead % featureFileRecordSize == 0); 1091Contracts.Assert(labelFileBytesRead / sizeof(long) == featuresFileBytesRead / featureFileRecordSize); 1099Contracts.Assert(featureTensorShape[0] <= featuresBufferBytes.Length / featureFileRecordSize); 1100Contracts.Assert(labelTensorShape[0] <= labelBufferBytes.Length / sizeof(long)); 1413Contracts.CheckValue(env, nameof(env));
VisionCatalog.cs (1)
129Contracts.CheckValue(catalog, nameof(catalog));