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");
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");
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\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\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\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\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");
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\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);
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.");
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);
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);
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));
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\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\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\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);
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\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\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\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\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\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\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\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\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\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\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))
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\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);
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);