2 writes to Length
Microsoft.ML.DataView (2)
VBuffer.cs (2)
120Length = length; 165Length = length;
796 references to Length
Microsoft.ML.AutoML (1)
ColumnInference\TextFileContents.cs (1)
106columnCounts.Add(line.Length);
Microsoft.ML.Core (56)
Data\AnnotationUtils.cs (3)
395if (catIndices.Length > 0 && catIndices.Length % 2 == 0 && catIndices.Length <= columnSlotsCount * 2)
Utilities\VBufferUtils.cs (53)
115Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality."); 122for (int i = 0; i < a.Length; i++) 166Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality."); 173for (int i = 0; i < a.Length; ++i) 180for (int i = 0; i < b.Length; i++) 190for (int i = 0; i < a.Length; i++) 304Contracts.CheckParam(0 <= slot && slot < dst.Length, nameof(slot)); 335bool needIndices = dstValuesCount + 1 < dst.Length; 336editor = VBufferEditor.Create(ref dst, dst.Length, dstValuesCount + 1, keepOldOnResize: true); 363dst.Length); 383editor.Values.Slice(min, dst.Length - min).Clear(); 401Contracts.Check(0 <= denseCount && denseCount <= dst.Length); 406if (denseCount == dst.Length) 416var newIndicesEditor = VBufferEditor.Create(ref dst, dst.Length, denseCount); 425if (newLen == dst.Length) 431var editor = VBufferEditor.Create(ref dst, dst.Length, newLen, keepOldOnResize: true); 451if (!src.IsDense || src.Length < 20) 458var sparseCountThreshold = (int)(src.Length * sparsityThreshold); 460for (int i = 0; i < src.Length; i++) 472var editor = VBufferEditor.Create(ref dst, src.Length, sparseCount); 476for (int i = 0; i < src.Length; i++) 591Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality."); 631for (int i = 0; i < dst.Length; i++) 665for (int i = 0; i < dst.Length; ++i) 670sIndex = ++sI == srcValues.Length ? src.Length : srcIndices[sI]; 689src.Length, 691maxValuesCapacity: src.Length); 726if (newCount == dst.Length) 747src.Length, 749maxValuesCapacity: dst.Length); 817sIndex = ++sI == srcValues.Length ? src.Length : srcIndices[sI]; 857src.Length, 859maxValuesCapacity: src.Length); 878Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality."); 881int length = src.Length; 894Contracts.Assert(srcValues.Length == src.Length); 938Contracts.Assert(srcValues.Length == src.Length); 1135Resize(ref dst, src.Length, 0); 1139src.Length, 1141maxValuesCapacity: src.Length); 1145for (int i = 0; i < src.Length; ++i) 1169Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality."); 1188Resize(ref dst, a.Length, 0); 1200editor = VBufferEditor.Create(ref dst, a.Length); 1205for (int i = 0; i < b.Length; i++) 1215for (int i = 0; i < a.Length; i++) 1224for (int i = 0; i < a.Length; i++) 1253editor = VBufferEditor.Create(ref dst, a.Length, newCount, requireIndicesOnDense: true);
Microsoft.ML.Core.Tests (45)
UnitTests\ScoreSchemaTest.cs (3)
67Assert.Equal(keyNames.Length, (scoreMetadata.Schema[0].Type as VectorDataViewType).Size); 76Assert.Equal(keyNames.Length, actualKeyNames.Length);
UnitTests\TestEntryPoints.cs (7)
2266if (v1.Length != v2.Length) 2272for (int i = 0; i < dense1.Length; i++) 4504Assert.Equal(5, treeValues.Length); 4506Assert.Equal(20, leafIndicators.Length); 4508Assert.Equal(15, pathIndicators.Length); 6097sumBldr.Reset(avg.Length, true);
UnitTests\TestVBuffer.cs (35)
182var length = a.Length; 201var length = a.Length; 225var length = a.Length; 256var length = a.Length; 290Assert.Equal(10, a.Length); 314Assert.Equal(10, a.Length); 325Contracts.Assert(a.Length == b.Length); 340b = new VBuffer<T2>(a.Length, indices.Length, values, indices); 382b = new VBuffer<T2>(a.Length, indices.Length, values, indices); 478dst = new VBuffer<TDst>(a.Length, indices.Count, values, indices.ToArray()); 514dst = new VBuffer<TDst>(a.Length, indices.Length, values, indices); 545Contracts.Assert(0 <= offset && a.Length <= b.Length - offset); 549if (offset == 0 && a.Length == b.Length) 554var editor = VBufferEditor.Create(ref aa, b.Length, aa.GetValues().Length, requireIndicesOnDense: true); 558for (int i = 0; i < aa.Length; i++) 638int offset = rgen.Next(b.Length - a.Length + 1); 667dst = VBufferEditor.Create(ref dst, a.Length, 0).Commit(); 715Assert.Equal(len, a.Length); 738Assert.Equal(copyLen, dst.Length); 764Assert.Equal(len, b.Length); 795Assert.Equal(len, b.Length); 899int expectedLength = Math.Max(1, a.Length - slotsDropped); 944len = dst.Length; 1014var editor = VBufferEditor.Create(ref dst, src.Length, src.GetValues().Length); 1029Assert.Equal(expected.Length, actual.Length); 1161Contracts.Assert(a.Length == len); 1162Contracts.Assert(b.Length == len); 1173Assert.Equal(expected.Length, actual.Length); 1175int length = expected.Length;
Microsoft.ML.Data (238)
Commands\ShowSchemaCommand.cs (2)
164if (names.Length != type.GetVectorSize()) 280itw.Write(": Length={0}, Count={0}", value.Length, value.GetValues().Length);
Data\BufferBuilder.cs (2)
395Contracts.Check(0 <= index && index <= _length - buffer.Length); 404Contracts.Assert(count == buffer.Length);
Data\DataViewUtils.cs (2)
1399bool isLong = vbuf.Length > previewValues; 1400var suffix = isLong ? string.Format(",...(+{0})", vbuf.Length - previewValues) : "";
Data\RowCursorUtils.cs (3)
276Contracts.Check(src.Length == size); 280var editor = VBufferEditor.Create(ref dst, src.Length, count); 437var editor = VBufferEditor.Create(ref dst, src.Length);
DataLoadSave\Binary\Codecs.cs (3)
911if (value.Length != _size) 912throw Contracts.Except("Length mismatch: expected {0} slots but got {1}", _size, value.Length); 915_lengths.Add(value.Length);
DataLoadSave\Text\TextLoader.cs (2)
1051if (names.Length > 0) 1055metadataBuilder.AddSlotNames(names.Length, (ref VBuffer<ReadOnlyMemory<char>> value) => names.CopyTo(ref value));
DataLoadSave\Text\TextSaver.cs (2)
171Contracts.Check(_slotNames.Length == typeNames.Size, "Unexpected slot names length"); 197length = _src.Length;
DataLoadSave\Transpose\TransposeLoader.cs (1)
823Ch.Assert(buff.Length == 1);
DataView\ArrayDataViewBuilder.cs (1)
490: base(itemType, values, v => v.Length)
DataView\CacheDataView.cs (4)
1365if (_uniformLength != 0 && _uniformLength != _temp.Length) 1366throw Ctx.Except("Caching expected vector of size {0}, but {1} encountered.", _uniformLength, _temp.Length); 1367Ctx.Assert(_uniformLength == 0 || _uniformLength == _temp.Length); 1380_lengths[rowCount - 1] = _temp.Length;
DataView\Transposer.cs (2)
699Ch.Assert(0 <= _slotCurr && _slotCurr < Utils.Size(_cbuff) && _cbuff[_slotCurr].Buffer.Length == _len); 1227Contracts.Assert(_inputValue.Length == Parent._lims[Parent._lims.Length - 1]);
DataView\TypedCursor.cs (4)
437if (Utils.Size(buf) != value.Length) 438buf = new TDst[value.Length]; 459if (value.Length == Utils.Size(buf) && value.IsDense) 469buf = new TDst[value.Length];
Deprecated\Instances\HeaderSchema.cs (1)
165ctx.Writer.Write(names.Length);
Deprecated\Vector\VBufferMathUtils.cs (28)
102int length = src.Length; 141Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality."); 149var editor = VBufferEditor.Create(ref dst, dst.Length); 151CpuMathUtils.Add(srcValues, editor.Values, src.Length); 169Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality."); 177var editor = VBufferEditor.Create(ref dst, dst.Length); 179CpuMathUtils.AddScale(c, srcValues, editor.Values, src.Length); 194Contracts.Check(src.Length == dst.Length, "Vectors must have the same dimensionality."); 195int length = src.Length; 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)); 253editor = VBufferEditor.Create(ref dst, dst.Length); 269int dLim = dstIndices.Length == 0 ? 0 : dstIndices.FindIndexSorted(dMin, dstIndices.Length, offset + src.Length); 270Contracts.Assert(dMin - dLim <= src.Length); 274gapCount = src.Length - (dLim - dMin); 297dst.Length, 322int iS = src.Length - 1; 389if (src.Length > 0 && src.IsDense) 392var editor = VBufferEditor.Create(ref dst, src.Length); 399VBufferUtils.Resize(ref dst, src.Length, 0); 410if (src.Length == 0) 446if (src.Length == 0)
Deprecated\Vector\VectorUtils.cs (24)
32Contracts.Check(Utils.Size(a) == b.Length, "Vectors must have the same dimensionality."); 37return CpuMathUtils.DotProductDense(a, bValues, b.Length); 43Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality."); 53return CpuMathUtils.DotProductDense(aValues, bValues, a.Length); 116var aEditor = VBufferEditor.Create(ref a, a.Length, newCount, requireIndicesOnDense: true); 162Contracts.Check(a.Length == dst.Length, "Vectors must have the same dimensionality."); 167CpuMathUtils.MulElementWise(a.GetValues(), dst.GetValues(), editor.Values, a.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."); 263return CpuMathUtils.DotProductDense(aValues.Slice(offset), bValues, b.Length); 271int aLim = Utils.FindIndexSorted(aIndices, 0, aIndices.Length, offset + b.Length); 306Contracts.Check(b.Length <= a.Length - offset, "VBuffer b must be no longer than a.Length - offset."); 313return CpuMathUtils.DotProductDense(a.AsSpan(offset), bValues, b.Length); 396Contracts.Check(a.Length == b.Length, "Vectors must have the same dimensionality."); 400return L2DiffSquaredDense(a.GetValues(), b.GetValues(), b.Length); 417Contracts.Check(Utils.Size(a) == b.Length, "Vectors must have the same dimensionality."); 419return L2DiffSquaredDense(a, b.GetValues(), b.Length); 444Contracts.CheckParam(src.Length == dst.Length, nameof(dst), "Arrays must have the same dimensionality."); 472Contracts.Check(src.Length <= dst.Length - offset, "Vector src must be no longer than dst.Length - offset."); 480for (int i = 0; i < src.Length; i++)
Evaluators\ClusteringEvaluator.cs (2)
433Host.Check(_scores.Length == _scoresArr.Length); 473Host.Check(_scores.Length == _scoresArr.Length);
Evaluators\EvaluatorUtils.cs (20)
483var map = maps[i] = new int[slotNamesCur.Length]; 512Contracts.Assert(src.Length == Utils.Size(map)); 536Contracts.Assert(src.Length == Utils.Size(map)); 697src.Length, 701for (int j = 0; j < src.Length; j++) 967if (currSlotNames.Length != firstDvSlotNames.Length) 980return firstDvSlotNames.Length == 0; 1401int numConfusionTableLabels = sample < 0 ? labelNames.Length : Math.Min(labelNames.Length, sample); 1405var labelIndexToConfIndexMap = new int[labelNames.Length]; 1406if (numConfusionTableLabels < labelNames.Length) 1408var tempPerm = Utils.GetRandomPermutation(host.Rand, labelNames.Length); 1409var sampledIndices = tempPerm.Skip(labelNames.Length - numConfusionTableLabels).OrderBy(i => i); 1419for (int i = 0; i < labelNames.Length; i++) 1428confusionTable = GetConfusionTableAsArray(confusionDataView, weightColumn.Value.Index, labelNames.Length, 1431confusionTable = GetConfusionTableAsArray(confusionDataView, countColumn.Index, labelNames.Length, 1443bool sampled = numConfusionTableLabels < labelNames.Length; 1503if (count.Length != numClasses) 1504throw Contracts.Except("Expected {0} values in 'Count' column, but got {1}.", numClasses, count.Length);
Evaluators\Metrics\MulticlassClassificationMetrics.cs (1)
132ConfusionMatrix = MetricWriter.GetConfusionMatrix(host, confusionMatrix, binary: false, perClassLogLoss.Length);
Evaluators\MulticlassClassificationEvaluator.cs (2)
106names = new ReadOnlyMemory<char>[labelNames.Length]; 445Host.Check(_scores.Length == _scoresArr.Length);
Evaluators\MultiOutputRegressionEvaluator.cs (3)
321Contracts.Check(_label.Length == _size); 323Contracts.Check(_score.Length == _size); 754ch.Assert(metricVals.Length == labelCount);
Evaluators\QuantileRegressionEvaluator.cs (10)
51Host.Assert(quantiles.IsDense && quantiles.Length == scoreSize); 140Contracts.Check(score.Length == TotalL1Loss.Length, "Vectors must have the same dimensionality."); 172Contracts.Check(loss.Length == TotalL1Loss.Length, "Vectors must have the same dimensionality."); 196var editor = VBufferEditor.Create(ref dst, src.Length); 224Host.Assert(slotNames.Length == 0 || slotNames.Length == size); 248if (_slotNames.Length > 0) 290if (quantiles.Length != scoreSize)
Scorers\ClusteringScorer.cs (2)
110Contracts.Check(score.Length == scoreLength); 121Contracts.Check(score.Length == scoreLength);
Scorers\FeatureContributionCalculation.cs (2)
216_env.Assert(0 <= index && index < slotNames.Length); 239var indices = contributions.IsDense ? Utils.GetIdentityPermutation(contributions.Length) : editor.Indices;
Scorers\MulticlassClassificationScorer.cs (2)
578Host.Check(score.Length == scoreLength); 589Host.Check(score.Length == scoreLength);
Scorers\SchemaBindablePredictorWrapper.cs (1)
723Contracts.Check(features.Length == featureCount || featureCount == 0);
Scorers\ScoreSchemaFactory.cs (2)
124if (keyNames.Length > 0) 125metadataBuilder.AddKeyValues(keyNames.Length, TextDataViewType.Instance,
Transforms\ColumnConcatenatingTransformer.cs (7)
716if (vectorType.Size != 0 && vectorType.Size != tmpBufs[i].Length) 719input.Schema[SrcIndices[i]].Name, vectorType.Size, tmpBufs[i].Length) 722dstLength = checked(dstLength + tmpBufs[i].Length); 747Contracts.Assert(buffer.Length <= dstLength - offset); 765offset += buffer.Length; 788Contracts.Assert(tmpBufs[j].Length <= dstLength - offset); 792offset += tmpBufs[j].Length;
Transforms\Hashing.cs (38)
253Host.Assert(_keyValues[invertIinfos[i]].Length == types[invertIinfos[i]].GetItemType().GetKeyCountAsInt32(Host)); 254_kvTypes[invertIinfos[i]] = new VectorDataViewType(TextDataViewType.Instance, _keyValues[invertIinfos[i]].Length); 561return (Hashing.MixHash(hash, values.Length * sizeof(uint)) & mask) + 1; 595return (Hashing.MixHash(hash, values.Length * sizeof(double)) & mask) + 1; 654return (Hashing.MixHash(hash, values.Length * sizeof(uint)) & mask) + 1; 678return (Hashing.MixHash(hash, values.Length * sizeof(uint)) & mask) + 1; 702return (Hashing.MixHash(hash, values.Length * sizeof(uint)) & mask) + 1; 734return (Hashing.MixHash(hash, values.Length * sizeof(ulong)) & mask) + 1; 764return (Hashing.MixHash(hash, values.Length * sizeof(uint)) & mask) + 1; 784return (Hashing.MixHash(hash, values.Length * sizeof(uint)) & mask) + 1; 804return (Hashing.MixHash(hash, values.Length * sizeof(uint)) & mask) + 1; 828return (Hashing.MixHash(hash, values.Length * sizeof(ulong)) & mask) + 1; 862return (Hashing.MixHash(hash, values.Length * sizeof(uint)) & mask) + 1; 899return (Hashing.MixHash(hash, values.Length * sizeof(uint)) & mask) + 1; 919return (Hashing.MixHash(hash, values.Length * sizeof(uint)) & mask) + 1; 939return (Hashing.MixHash(hash, values.Length * sizeof(uint)) & mask) + 1; 959return (Hashing.MixHash(hash, values.Length * sizeof(uint)) & mask) + 1; 983return (Hashing.MixHash(hash, values.Length * sizeof(long)) & mask) + 1; 1045VBufferUtils.Resize(ref dst, src.Length, 0); 1048var editor = VBufferEditor.Create(ref dst, src.Length, srcValues.Length); 1062var editor = VBufferEditor.Create(ref dst, src.Length); 1076for (int i = 0; i < src.Length; ++i) 1099VBufferUtils.Resize(ref dst, src.Length, 0); 1102var editor = VBufferEditor.Create(ref dst, src.Length, srcValues.Length); 1116var editor = VBufferEditor.Create(ref dst, src.Length); 1130for (int i = 0; i < src.Length; ++i) 1163VBufferUtils.Resize(ref dst, src.Length, 0); 1166var editor = VBufferEditor.Create(ref dst, src.Length, srcValues.Length); 1188var editor = VBufferEditor.Create(ref dst, src.Length); 1200for (int i = 0; i < src.Length; i++) 1227VBufferUtils.Resize(ref dst, src.Length, 0); 1230var editor = VBufferEditor.Create(ref dst, src.Length, srcValues.Length); 1252var editor = VBufferEditor.Create(ref dst, src.Length); 1264for (int i = 0; i < src.Length; i++) 1681Contracts.Assert(_value.Length == _hash.Length); 1726Contracts.Assert(_value.Length == _hash.Length);
Transforms\InvertHashUtils.cs (3)
419writer.WriteLine("# Number of terms = {0} of length {1}", v.GetValues().Length, v.Length); 469kvTypesLocal[iinfo] = new VectorDataViewType(TextDataViewType.Instance, keyValuesLocal[iinfo].Length); 495if (keyValues[iinfo].Length == 0)
Transforms\KeyToValue.cs (3)
260Host.Check(keyMetadata.Length == keyItemType.GetKeyCountAsInt32(Host)); 388int srcSize = src.Length; 528var keys = Array.ConvertAll<int, long>(Enumerable.Range(1, _values.Length).ToArray(), item => Convert.ToInt64(item));
Transforms\KeyToVector.cs (4)
383Host.Check(namesSlotSrc.Length == typeSrc.Size); 395Host.Check(namesKeySrc.Length == keyCount); 527Host.Check(cv == 0 || src.Length == cv); 570int lenSrc = src.Length;
Transforms\NormalizeColumnDbl.cs (14)
356Contracts.Check(value.Length == size); 793Contracts.Check(dst.Length == Scale.Length); 803Contracts.Check(dst.Length == Scale.Length); 813Contracts.Check(dst.Length == Scale.Length); 825Contracts.Assert(input.Length == scale.Length); 855Contracts.Assert(input.Length == scale.Length); 899Contracts.Assert(input.Length == scale.Length); 1088Host.Check(dst.Length == Mean.Length); 1099Contracts.Assert(input.Length == mean.Length); 1302Host.Check(dst.Length == _binUpperBounds.Length); 1310Contracts.Assert(input.Length == _binUpperBounds.Length); 1586if (buffer.Length != size) 1587throw Host.Except("Normalizer expected {0} slots but got {1}", size, buffer.Length); 1934Host.Check(buffer.Length == size);
Transforms\NormalizeColumnSng.cs (14)
356Contracts.Check(value.Length == size); 950Contracts.Check(dst.Length == Scale.Length); 960Contracts.Check(dst.Length == Scale.Length); 970Contracts.Check(dst.Length == Scale.Length); 982Contracts.Assert(input.Length == scale.Length); 1013Contracts.Assert(input.Length == scale.Length); 1058Contracts.Assert(input.Length == scale.Length); 1248Host.Check(dst.Length == Mean.Length); 1259Contracts.Assert(input.Length == mean.Length); 1463Host.Check(dst.Length == _binUpperBounds.Length); 1471Contracts.Assert(input.Length == _binUpperBounds.Length); 1749if (buffer.Length != size) 1750throw Host.Except("Normalizer expected {0} slots but got {1}", size, buffer.Length); 2097Host.Check(buffer.Length == size);
Transforms\SlotsDroppingTransformer.cs (3)
859if (dst.Length > 0) 861Contracts.Assert(dst.Length % 2 == 0); 864builder.Add(AnnotationUtils.Kinds.CategoricalSlotRanges, AnnotationUtils.GetCategoricalType(dst.Length / 2), categoricalSlotRangesGetter);
Transforms\ValueMapping.cs (1)
921var editor = VBufferEditor.Create(ref dst, src.Length);
Transforms\ValueToKeyMappingTransformerImpl.cs (13)
791var editor = VBufferEditor.Create(ref dst, src.Length); 950int cval = src.Length; 985int cval = src.Length; 1004for (int slot = 0; slot < src.Length; ++slot) 1014int nextExplicitSlot = indices.Length == 0 ? src.Length : indices[0]; 1016for (int slot = 0; slot < src.Length; ++slot) 1025nextExplicitSlot = ++islot == indices.Length ? src.Length : indices[islot]; 1128_host.Assert(srcMeta.Length == srcType.GetCountAsInt32(_host)); 1139_host.Assert(0 < convKeyVal && convKeyVal <= srcMeta.Length); 1156_host.Assert(dst.Length == keyCount); 1166_host.Assert(dst.Length == keyCount); 1205if (srcMeta.Length != srcType.GetCountAsInt32(_host)) 1223_host.Assert(0 < convKeyVal && convKeyVal <= srcMeta.Length);
Utilities\ColumnCursor.cs (2)
149var dst = new T[curValue.Length]; 171var dst = new TOut[curValue.Length];
Utilities\SlotDropper.cs (8)
104if (src.Length <= SlotsMin[0]) 111int newLength = DstLength == 0 ? ComputeLength(src.Length) : DstLength; 119Contracts.Assert(newLength < src.Length); 131for (int i = 0; i < SlotsMax.Length && iSrc < src.Length; i++) 133var lim = Math.Min(SlotsMin[i], src.Length); 141while (iSrc < src.Length) 157Contracts.Assert(newCount <= src.Length); 211min = max = src.Length;
Microsoft.ML.DataView (39)
VBuffer.cs (37)
44/// The number of items explicitly represented. This equals <see cref="Length"/> when the representation 45/// is dense and less than <see cref="Length"/> when sparse. 62/// of the returned value will equal <see cref="Length"/>, and otherwise will have length less than 63/// <see cref="Length"/>. 71/// <see cref="Length"/> exclusive, corresponding to all explicitly defined values. All values at unspecified 89Debug.Assert(_count <= Length); 90return _count == Length; 174/// <param name="destination">The destination buffer. After the copy, this will have <see cref="VBuffer{T}.Length"/> 175/// of <see cref="Length"/>.</param> 179var editor = VBufferEditor.Create(ref destination, Length); 183else if (Length > 0) 184_values.AsSpan(0, Length).CopyTo(editor.Values); 191/// <param name="destination">The destination buffer. After the copy, this will have <see cref="VBuffer{T}.Length"/> 192/// of <see cref="Length"/>.</param> 195var editor = VBufferEditor.Create(ref destination, Length, _count); 198if (Length > 0) 200_values.AsSpan(0, Length).CopyTo(editor.Values); 219/// <param name="destination">The destination buffer. After the copy, this will have <see cref="VBuffer{T}.Length"/> 225Contracts.CheckParam(0 <= sourceIndex && sourceIndex <= Length, nameof(sourceIndex)); 226Contracts.CheckParam(0 <= length && sourceIndex <= Length - length, nameof(length)); 270/// <param name="destination">The destination buffer. This <see cref="Span{T}.Length"/> must have least <see cref="Length"/>.</param> 279/// <param name="destination">The destination buffer. This <see cref="Span{T}.Length"/> must be at least <see cref="Length"/> 287Contracts.CheckParam(0 <= destinationIndex && destinationIndex <= destination.Length - Length, 290if (Length == 0) 294_values.AsSpan(0, Length).CopyTo(destination.Slice(destinationIndex)); 300destination.Slice(destinationIndex, Length).Clear(); 314while (iv < Length) 344return Items(_values, _indices, Length, _count, all); 348/// Returns an enumerable with <see cref="Length"/> items, representing the values. 352return DenseValues(_values, _indices, Length, _count); 371/// <param name="index">The index, which must be a non-negative number less than <see cref="Length"/>.</param> 376Contracts.CheckParam(0 <= index && index < Length, nameof(index)); 390/// <param name="index">The index, which must be a non-negative number less than <see cref="Length"/>.</param> 395Contracts.CheckParam(0 <= index && index < Length, nameof(index)); 405=> IsDense ? $"Dense vector of size {Length}" : $"Sparse vector of size {Length}, {_count} explicit values"; 417return GetEditor(Length, _count);
VectorType.cs (2)
115/// A vector whose size is known should correspond to values that always have the same <see cref="VBuffer{T}.Length"/>, 116/// whereas one whose size is unknown may have values whose <see cref="VBuffer{T}.Length"/> varies from record to record.
Microsoft.ML.Ensemble (19)
EnsembleUtils.cs (6)
49Contracts.Assert(Utils.Size(includedIndices) == src.Length); 51Contracts.Assert(cardinality < src.Length); 56if (cardinality >= src.Length / 2) 59var editor = VBufferEditor.Create(ref dst, src.Length); 66var editor = VBufferEditor.Create(ref dst, src.Length, cardinality); 86var editor = VBufferEditor.Create(ref dst, src.Length, cardinality);
OutputCombiners\BaseMultiCombiner.cs (2)
75if (len < item.Length) 76len = item.Length;
OutputCombiners\MultiMedian.cs (1)
92raw[j] = i < src[j].Length ? src[j].GetItemOrDefault(i) : 0;
OutputCombiners\MultiStacking.cs (2)
87len += src[i].Length; 95iv += src[i].Length;
PipelineEnsemble.cs (3)
652var classCount = labelNames.Length; 682if (v1.Length != v2.Length)
Trainer\EnsembleDistributionModelParameters.cs (2)
154Host.Check(src.Length == _inputType.Size); 192Host.Check(src.Length == _inputType.Size);
Trainer\EnsembleModelParameters.cs (1)
146Host.Check(src.Length == _inputType.Size);
Trainer\Multiclass\EnsembleMulticlassModelParameters.cs (2)
131Host.Check(src.Length == _inputType.Size); 146Host.Check(predictions[i].Length == _mappers[i].OutputType.GetVectorSize());
Microsoft.ML.FastTree (34)
BinFile\BinFinder.cs (5)
60if (values.Length == 0) 63counts[0] = values.Length; 82counts[0] = values.Length - explicitValuesCount; 100counts[idist] = values.Length - explicitValuesCount; 125counts[idist] = values.Length - explicitValuesCount;
FastTree.cs (20)
1195ch.Assert(binnedValues.Length == values.Length); 1209bins = new Dense0BitIntArray(values.Length); 1210else if (!values.IsDense && zeroBin == 0 && valuesValues.Length < (1 - sparsifyThreshold) * values.Length) 1215bins = new DeltaSparseIntArray(values.Length, numBitsNeeded, nonZeroValues); 1225for (int i = 0; i < values.Length; i++) 1229Array.Clear(binnedValues, 0, values.Length); 1237firstBinCount += values.Length - valuesValues.Length; 1254bins = IntArray.New(values.Length, arrayType, IntArray.NumBitsNeeded(binUpperBounds.Length), binnedValues); 1311var editor = VBufferEditor.Create(ref dst, src.Length, srcValues.Length); 1416Host.Assert(temp.Length == numExamples); 1444ch.Assert(slotDropper.DstLength < temp.Length); 1446temp.Length - slotDropper.DstLength, temp.Length); 1678BitArray rowHasMissing = new BitArray(temp.Length); 1710return new SlotDropper(temp.Length, minSlots.ToArray(), maxSlots.ToArray()); 1719if (groupIds.Length > 0) 2924Host.Check(src.Length == inputVectorSize); 2926Host.Check(src.Length > MaxSplitFeatIdx); 2952Host.Check(src.Length == inputVectorSize); 2954Host.Check(src.Length > MaxSplitFeatIdx);
GamModelParameters.cs (3)
204Host.CheckParam(features.Length == _numInputFeatures, nameof(features), "Bad length of input"); 235Host.CheckParam(features.Length == _numInputFeatures, nameof(features)); 419var editor = VBufferEditor.Create(ref contributions, features.Length);
RandomForestRegression.cs (2)
236Host.Check(src.Length == inputVectorSize); 238Host.Check(src.Length > MaxSplitFeatIdx);
TreeEnsemble\InternalTreeEnsemble.cs (4)
354builder.Reset(features.Length, false); 429public int Count => _names.Length; 451Contracts.Assert(_names.Length == _content.Length);
Microsoft.ML.IntegrationTests (2)
Explainability.cs (2)
132Assert.Equal(HousingRegression.Features.Length, weights.Length); 159Assert.Equal(HousingRegression.Features.Length, weights.Length);
Microsoft.ML.KMeansClustering (10)
KMeansModelParameters.cs (8)
80Host.CheckParam(centroids[0].Length > 0, nameof(centroids), "Centroid vectors should have at least one length"); 83_dimensionality = centroids[0].Length; 89Host.CheckParam(centroids[i].Length == _dimensionality, 155if (src.Length != _dimensionality) 156throw Host.Except($"Incorrect number of features: expected {_dimensionality}, got {src.Length}"); 185Host.Assert(_dimensionality == _centroids[i].Length); 243Contracts.Assert(_centroids[i].Length == _dimensionality); 323var shapeC = new long[] { _centroids.Length, _centroids[0].Length };
KMeansPlusPlusTrainer.cs (2)
1793Contracts.Assert(features.Length == centroids[0].Length);
Microsoft.ML.Mkl.Components (13)
OlsLinearRegression.cs (10)
787Contracts.Assert(Utils.Size(standardErrors) == weights.Length + 1); 788Contracts.Assert(Utils.Size(tValues) == weights.Length + 1); 789Contracts.Assert(Utils.Size(pValues) == weights.Length + 1); 791for (int i = 0; i <= weights.Length; ++i) 819int m = Weight.Length + 1; 851int m = Weight.Length + 1; 873Contracts.Assert(Weight.Length + 1 == _standardErrors.Length); 874Contracts.Assert(Weight.Length + 1 == _tValues.Length); 875Contracts.Assert(Weight.Length + 1 == _pValues.Length); 902AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, Weight.Length, ref names);
SymSgdClassificationTrainer.cs (1)
253Host.CheckParam(weights.Length > 0, nameof(weights));
VectorWhitening.cs (2)
617Host.Check(src.Length == cslotSrc, "Invalid column size."); 684int length = src.Length;
Microsoft.ML.OnnxConverter (1)
SaveOnnxCommand.cs (1)
240node.AddAttribute("values_int64s", Enumerable.Range(0, slotNames.Length).Select(x => (long)x));
Microsoft.ML.OnnxTransformer (1)
OnnxTransform.cs (1)
914_tensorShape[_zeroIndex] = _vBufferDense.Length / _denominator;
Microsoft.ML.OnnxTransformerTest (9)
DnnImageFeaturizerTest.cs (1)
125Assert.Equal(512, buffer.Length);
OnnxTransformTests.cs (8)
280Assert.Equal(1000, buffer.Length); 331Assert.Equal(1000, buffer.Length); 381Assert.Equal(1000, buffer.Length); 453Assert.Equal(5, buffera.Length); 454Assert.Equal(5, bufferb.Length); 493Assert.Equal(5, buffera.Length); 494Assert.Equal(5, bufferb.Length); 515Assert.Equal(5, bufferb.Length);
Microsoft.ML.PCA (3)
PcaTrainer.cs (2)
625Host.Check(src.Length == _dimension); 633Host.Assert(src.Length == _dimension);
PcaTransformer.cs (1)
589ectx.Check(src.Length == transformInfo.Dimension);
Microsoft.ML.Predictor.Tests (4)
TestPredictors.cs (3)
949Assert.Equal(vectorScore.Length, vectorScores[i].Length); 950for (int i = 0; i < vectorScore.Length; i++)
TestTransposer.cs (1)
95Assert.True(rc == temp.Length, $"{desc} slot cursor yielded vector with unexpected length");
Microsoft.ML.StandardTrainers (121)
FactorizationMachine\FieldAwareFactorizationMachineUtils.cs (1)
45bias += featureBuffer.Length;
LdSvm\LdSvmModelParameters.cs (29)
63Host.Assert(w.All(v => v.Length == w[0].Length)); 66Host.Assert(thetaPrime.All(v => v.Length == thetaPrime[0].Length)); 69Host.Assert(theta.All(v => v.Length == theta[0].Length)); 73Host.Assert((w[0].Length > 0) && (w[0].Length == thetaPrime[0].Length) && (w[0].Length == theta[0].Length)); 84InputType = new VectorDataViewType(NumberDataViewType.Single, _w[0].Length); 131Host.Assert(_w.All(v => v.Length == _w[0].Length)); 134Host.Assert(_thetaPrime.All(v => v.Length == _thetaPrime[0].Length)); 137Host.Assert(_theta.All(v => v.Length == _theta[0].Length)); 141Host.Assert((_w[0].Length > 0) && (_w[0].Length == _thetaPrime[0].Length) && (_w[0].Length == _theta[0].Length)); // numFeatures 142Host.Assert(InputType != null && InputType.GetVectorSize() == _w[0].Length); 180int numFeatures = _w[0].Length; 211int vectorLength = data[0].Length; 216Host.Assert(vector.Length == vectorLength); 239Host.Assert(result[i].Length == vectorLength); 276Host.Check(src.Length == InputType.GetVectorSize());
Optimizer\DifferentiableFunction.cs (10)
105if (_tempGrads[chunkIndex].Length == 0) 135if (gradient.Length == 0) 198int numIters = Math.Min((int)x.Length, 10); 199int maxDirCount = Math.Min((int)x.Length / 2, 100); 208int index = _r.Next((int)x.Length); 210index = _r.Next((int)x.Length); 214VBuffer<float> dir = new VBuffer<float>(x.Length, values.Count, values.ToArray(), indices.ToArray()); 262VBuffer<float> dir = new VBuffer<float>(x.Length, 1, new float[] { 1 }, new int[] { 0 }); 263for (int n = 0; n < x.Length; n++) 301VBuffer<float> dir = new VBuffer<float>(x.Length, 1, new float[] { 1 }, new int[] { 0 });
Optimizer\L1Optimizer.cs (2)
58if (_l1weight > 0 && _biasCount < initial.Length) 80ch.Assert(0 <= biasCount && biasCount < initial.Length);
Optimizer\Optimizer.cs (3)
206Dim = initial.Length; 213Dim = initial.Length; 608ch.Info("num vars: {0}", initial.Length);
Optimizer\SgdOptimizer.cs (5)
169int dim = initial.Length; 181VBufferUtils.Resize(ref step, step.Length, 0); 318int dim = initial.Length; 398Contracts.Assert(x.Length == xprev.Length, "Vectors must have the same dimensionality.");
Standard\LinearModelParameters.cs (20)
67public int Count => _pred.Weight.Length; 128_inputType = new VectorDataViewType(NumberDataViewType.Single, Weight.Length); 202_inputType = new VectorDataViewType(NumberDataViewType.Single, Weight.Length); 226ctx.Writer.Write(Weight.Length); 277if (features.Length != Weight.Length) 278throw Contracts.Except("Input is of length {0} does not match expected length of weights {1}", features.Length, Weight.Length); 288if (_weightsDense.Length == 0 && Weight.Length > 0) 293if (_weightsDense.Length == 0 && Weight.Length > 0) 317if (src.Length != Weight.Length) 318throw Contracts.Except("Input is of length {0}, but predictor expected length {1}", src.Length, Weight.Length); 377AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, Weight.Length, ref names); 379subBuilder.AddSlotNames(Weight.Length, (ref VBuffer<ReadOnlyMemory<char>> dst) => names.CopyTo(ref dst)); 380var colType = new VectorDataViewType(NumberDataViewType.Single, Weight.Length); 552AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, Weight.Length, ref names);
Standard\LinearPredictorUtils.cs (3)
38AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, weights.Length, ref featureNames); 106AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, weights.Length, ref featureNames); 232AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, weights.Length, ref names);
Standard\LogisticRegression\LbfgsPredictorBase.cs (5)
381VBufferUtils.Resize(ref grad, grad.Length, 0); 709ch.Assert(CurrentWeights.Length == BiasCount + WeightCount); 729Contracts.Assert(vec.Length == BiasCount + WeightCount); 747Contracts.Assert(x.Length == BiasCount + WeightCount); 748Contracts.Assert(gradient.Length == BiasCount + WeightCount);
Standard\LogisticRegression\LogisticRegression.cs (6)
270var featureLength = CurrentWeights.Length - BiasCount; 274Host.Assert(namesSpans.Length == featureLength); 283bool denseWeight = numParams == CurrentWeights.Length; 412CurrentWeights.CopyTo(ref weightsOnly, 1, CurrentWeights.Length - 1); 413var std = LbfgsTrainerOptions.ComputeStandardDeviation.ComputeStandardDeviation(hessian, weightIndices, numParams, CurrentWeights.Length, ch, L2Weight); 455CurrentWeights.CopyTo(ref weights, 1, CurrentWeights.Length - 1);
Standard\LogisticRegression\MulticlassLogisticRegression.cs (9)
459Contracts.Assert(weights.Length == numClasses + numClasses * numFeatures); 467Contracts.Assert(weights.Length == NumberOfClasses + NumberOfClasses * NumberOfFeatures); 515Contracts.Assert(weights[iClass].Length == NumberOfFeatures); 633Host.Assert(fw.Length == NumberOfFeatures); 664Host.Assert(fv.Length == NumberOfFeatures); 775Host.Check(src.Length == NumberOfFeatures); 784Host.Check(src.Length == NumberOfFeatures, "src length should equal the number of features"); 1049int featuresCount = Weights[0].Length; 1052Host.Assert(featuresCount == Weights[i].Length);
Standard\ModelStatistics.cs (14)
250Env.Assert(coeffStdError.Length > 0, nameof(coeffStdError)); 251Env.Assert(weights.Length > 0, nameof(weights)); 322ctx.Writer.Write(_coeffStdError.Length); 331ctx.Writer.Write(_weights.Length); 360Contracts.Assert(_coeffStdError.Length == _weights.Length + 1); 377Contracts.Assert(0 <= wi && wi < _weights.Length); 408Env.Assert(_coeffStdError.Length == _weights.Length + 1); 420Env.Assert(0 <= wi && wi < _weights.Length); 435Env.Assert(names.Length > 0, "FeatureColumnName has no metadata."); 445Env.Assert(0 <= wi && wi < _weights.Length); 579subMetaBuilder.AddSlotNames(stdErr.Length, getSlotNames); 581var colType = new VectorDataViewType(NumberDataViewType.Single, stdErr.Length);
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (1)
598Host.Check(src.Length == _featureCount, "Invalid number of features passed.");
Standard\MulticlassClassification\OneVersusAllTrainer.cs (3)
633Contracts.Check(src.Length == inputSize); 726Contracts.Check(src.Length == inputSize); 882Contracts.Check(src.Length == inputSize);
Standard\MulticlassClassification\PairwiseCouplingTrainer.cs (1)
472Host.Check(src.Length == _inputType.Size);
Standard\Online\LinearSvm.cs (1)
165VBufferUtils.Resize(ref _weightsUpdate, _weightsUpdate.Length, 0);
Standard\PoissonRegression\PoissonRegression.cs (1)
192CurrentWeights.CopyTo(ref weights, 1, CurrentWeights.Length - 1);
Standard\SdcaBinary.cs (3)
1529Host.CheckParam(weights[0].Length > 0, nameof(weights)); 1817Host.CheckParam(weights[0].Length > 0, nameof(weights)); 2219Host.CheckParam(weights.Length > 0, nameof(weights));
Standard\SdcaMulticlass.cs (3)
370int numFeatures = weights[0].Length; 561return new MaximumEntropyModelParameters(Host, weights, bias, bias.Length, weights[0].Length, null, stats: null); 658return new LinearMulticlassModelParameters(Host, weights, bias, bias.Length, weights[0].Length, null, stats: null);
Standard\SdcaRegression.cs (1)
148Host.CheckParam(weights[0].Length > 0, nameof(weights));
Microsoft.ML.TensorFlow (2)
TensorflowTransform.cs (2)
903_denseData = new T[_vBuffer.Length]; 913_position += _vBuffer.Length;
Microsoft.ML.TensorFlow.Tests (8)
TensorFlowEstimatorTests.cs (2)
180Assert.Equal(10, buffer.Length); 273Assert.Equal(10, buffer.Length);
TensorflowTests.cs (6)
607Assert.Equal(1, inputOps.Length); 621Assert.Equal(2, inputOps.Length); 636Assert.Equal(1, inputOps.Length); 1045Assert.Equal(10, buffer.Length); 1046Assert.Equal(10, buffer2.Length); 1090Assert.Equal(10, buffer.Length);
Microsoft.ML.TestFramework (12)
BaseTestBaseline.cs (3)
771Assert.Equal(expectedVector.Length, actualVector.Length); 773for (int i = 0; i < expectedVector.Length; ++i)
DataPipe\TestDataPipe.cs (9)
237Check(TestCommon.CompareVec(in v1, in v2, v1.Length, fn), "Mismatch"); 593if (!TestCommon.CompareVec(in bag1, in bag2, bag1.Length, (x1, x2) => x1 <= x2)) 635if (!TestCommon.CompareVec(in bag1, in bag2, bag1.Length, (x1, x2) => 2 * x1 == x2)) 787if (!TestCommon.CompareVec(in b1, in b2, b1.Length, (x1, x2) => 2 * x1 == x2)) 1157Assert.True(resultRow.Length == r.Length); 1225Assert.Equal(barSlots, value2.Length); 1570Assert.True(resultFirstRow.Length == 3); 1574Assert.True(resultSecondRow.Length == 3); 1578Assert.True(resultThirdRow.Length == 3);
Microsoft.ML.TestFrameworkCommon (8)
TestCommon.cs (8)
138Assert.True(size == 0 || v1.Length == size); 139Assert.True(size == 0 || v2.Length == size); 140Assert.True(v1.Length == v2.Length); 147for (int i = 0; i < v1.Length; i++) 164int iv1 = v1.IsDense ? iiv1 : iiv1 < v1Indices.Length ? v1Indices[iiv1] : v1.Length; 165int iv2 = v2.IsDense ? iiv2 : iiv2 < v2Indices.Length ? v2Indices[iiv2] : v2.Length; 171if (iv1 == v1.Length)
Microsoft.ML.Tests (65)
OnnxConversionTest.cs (3)
1525Assert.Equal(mlNetSlots.Length, onnxSlots.Length); 1528for (int j = 0; j < mlNetSlots.Length; j++)
Scenarios\Api\TestApi.cs (1)
217var coltypeVBuffer = new VectorDataViewType(coltypeFloat, valueVBuffer.Length);
SvmLightTests.cs (1)
333Assert.True(features.Length == 4);
TextLoaderTests.cs (2)
777Assert.Equal(4, featureValue.Length); 798Assert.Equal(2, featureValue.Length);
TrainerEstimators\TreeEnsembleFeaturizerTest.cs (3)
69Assert.Equal(10, slotNames.Length); 92Assert.Equal(50, leafIdsSlotNames.Length); 115Assert.Equal(40, pathIdsSlotNames.Length);
Transformers\CategoricalHashTests.cs (12)
145Assert.True(slots.Length == 65536); 151Assert.True(slots.Length == 65536); 158Assert.True(slots.Length == 65536); 164Assert.True(slots.Length == 65536); 171Assert.True(slots.Length == 131072); 176Assert.True(slotRanges.Length == 4); 183Assert.True(slots.Length == 65536); 186Assert.True(slotRanges.Length == 2); 193Assert.True(slots.Length == 65536); 199Assert.True(slots.Length == 65536); 205Assert.True(slots.Length == 36); 210Assert.True(slots.Length == 18);
Transformers\CategoricalTests.cs (15)
145Assert.Equal(3, slotNames.Length); 223Assert.True(slots.Length == 2); 229Assert.True(slots.Length == 1); 236Assert.True(slots.Length == 2); 242Assert.True(slots.Length == 2); 249Assert.True(slots.Length == 12); 252Assert.True(slotRanges.Length == 4); 259Assert.True(slots.Length == 2); 262Assert.True(slotRanges.Length == 2); 269Assert.True(slots.Length == 3); 275Assert.True(slots.Length == 2); 281Assert.True(slots.Length == 6); 287Assert.True(slots.Length == 2); 294Assert.True(slots.Length == 6); 300Assert.True(slots.Length == 3);
Transformers\ConvertTests.cs (3)
298Assert.Equal(3, slotNames.Length); 355Assert.True(slots.Length == 2); 361Assert.True(slots.Length == 2);
Transformers\HashTests.cs (5)
174Assert.Equal(vecLen, vecResult.Length); 183Assert.Equal(vecLen, vecResult.Length); 204Assert.Equal(10, vecResult.Length); 213Assert.Equal(10, vecResult.Length); 399Assert.True(buffer.Length == 1);
Transformers\KeyToBinaryVectorEstimatorTest.cs (2)
119Assert.True(slots.Length == 6); 125Assert.True(slots.Length == 2);
Transformers\KeyToVectorEstimatorTests.cs (10)
138Assert.True(slots.Length == 2); 144Assert.True(slots.Length == 1); 147Assert.True(slotRanges.Length == 2); 154Assert.True(slots.Length == 4); 157Assert.True(slotRanges.Length == 4); 164Assert.True(slots.Length == 2); 171Assert.True(slotRanges.Length == 4); 182Assert.True(slots.Length == 3); 188Assert.True(slots.Length == 2); 191Assert.True(slotRanges.Length == 2);
Transformers\NAIndicatorTests.cs (1)
147Assert.True(value.Length == 4);
Transformers\ValueMappingTests.cs (7)
208Assert.Equal(values[1].Length, dValue.Length); 211Assert.Equal(values[2].Length, eValue.Length); 214Assert.Equal(values[0].Length, fValue.Length); 290Assert.Equal(3, dValue.Length); 294Assert.Equal(4, eValue.Length); 298Assert.Equal(2, fValue.Length); 579Assert.Equal(3, allowedKeys.Length);
Microsoft.ML.TorchSharp (11)
AutoFormerV2\ObjectDetectionMetrics.cs (2)
320for (int i = 0; i < score.Length; i++) 362for (int i = 0; i < predLab.Length; i++)
AutoFormerV2\ObjectDetectionTrainer.cs (2)
401var labelTensor = torch.zeros(1, labels.Length, 5, dtype: ScalarType.Int64, device: Device); 402for (int i = 0; i < labels.Length; i++)
NasBert\NerTrainer.cs (7)
131VBuffer<long> t = new VBuffer<long>(target.Length + 1, tl.ToArray()); 141if (x.Length > maxLength) 142maxLength = x.Length; 150for (int j = 0; j < targets[i].Length; j++) 155for (int j = targets[i].Length; j < maxLength; j++) 172if (target.Length != encoding.Count) 225Parent.Option.NumberOfClasses = keys.Length + 1;
Microsoft.ML.TorchSharp.Tests (7)
NerTests.cs (7)
101Assert.Equal(labelData.Length, predictedLabelData.Length); 180Assert.Equal(labelData.Length, predictedLabelData.Length); 252Assert.Equal(labelData.Length, predictedLabelData.Length); 254for (var i = 0; i < labelData.Length; i++)
Microsoft.ML.Transforms (83)
CountFeatureSelection.cs (1)
432Contracts.Check(value.Length == size);
Dracula\CountTableTransformer.cs (6)
209_host.Check(srcBuffer.Length == cols[i].Type.GetVectorSize(), "value count mismatch"); 281var n = srcBuffer.Length; 316ectx.Check(keyNames.Length == labelCardinality); 646Host.Assert(inputSlotNames.Length == inputCol.Type.GetValueCount()); 653int nFeatures = featureNames.Length; 655var editor = VBufferEditor.Create(ref dst, nFeatures * inputSlotNames.Length);
ExpressionTransformer.cs (10)
622var editor = VBufferEditor.Create(ref dst, src0.Length, count); 638int len = src0.Length; 685int len = src0.Length; 693int len = src0.Length; 748int len = src0.Length; 756int len = src0.Length; 814int len = src0.Length; 822int len = src0.Length; 883int len = src0.Length; 891int len = src0.Length;
GcnTransform.cs (7)
385var mean = Mean(srcValues, src.Length); 386var divisor = StdDev(srcValues, src.Length, mean); 396var mean = Mean(srcValues, src.Length); 407var mean = Mean(srcValues, src.Length); 418var mean = Mean(srcValues, src.Length); 436var divisor = StdDev(src.GetValues(), src.Length); 477int length = src.Length;
HashJoiningTransform.cs (3)
426|| srcSlotNames.Length != Infos[iinfo].TypeSrc.GetValueCount(); 547Host.Check(src.Length == expectedSrcLength); 595Host.Check(src.Length == expectedSrcLength);
KeyToVectorMapping.cs (6)
299Host.Check(namesSlotSrc.Length == srcVectorSize); 374Contracts.Assert(dst.Length == bitsPerKey); 399Host.Check(src.Length == cv || cv == 0); 400bldr.Reset(src.Length * bitsPerKey, false); 411Contracts.Assert(dst.Length == src.Length * bitsPerKey);
LearnerFeatureSelection.cs (4)
109ch.Info(MessageSensitivity.Schema, "Selected {0} slots out of {1} in column '{2}'", selectedCount, scores.Length, options.FeatureColumn); 195range.max = max == scoresIndices.Length - 1 ? scores.Length - 1 : scoresIndices[max + 1] - 1; 214var gapMax = ii == scoresIndices.Length ? scores.Length - 1 : scoresIndices[ii] - 1; 222slots.Add((scores.Length, null));
MissingValueDroppingTransformer.cs (2)
312VBufferUtils.Resize(ref dst, src.Length - srcValues.Length, 0); 339var newLength = src.Length - srcValues.Length - newCount;
MissingValueIndicatorTransform.cs (3)
209Host.Check(names.Length == srcVectorType.Size, "Unexpected slot name vector size"); 264Host.Assert(dst.Length == 2); 296int size = buffer.Length;
MissingValueIndicatorTransformer.cs (1)
292FillValues(src.Length, ref dst, indices, sense);
MissingValueReplacing.cs (7)
256Host.Assert(srcType.Size == src.Length); 268Host.Assert(valReturn.Length == src.Length); 700Host.Check(src.Length == repArray.Length); 712int srcSize = src.Length; 781Host.Assert(rep.Length == src.Length); 783Host.Assert(repIsDefault.Length == src.Length); 786int srcSize = src.Length;
MissingValueReplacingUtils.cs (1)
226_valueCount = Add(_valueCount, (ulong)src.Length);
MutualInformationFeatureSelection.cs (11)
569for (int i = 0; i < labels.Length; i++) 686Contracts.Assert(_labels.Length == features.Length); 714score += _contingencyTable[i][j] / (double)_labels.Length * Math.Log(_contingencyTable[i][j] * (double)_labels.Length / ((double)_labelSums[i] * _featureSums[j]), 2); 728Contracts.Assert(_labels.Length == features.Length); 800var bounds = _binFinder.FindBins(numBins, _singles, input.Length - input.GetValues().Length); 826var bounds = _binFinder.FindBins(numBins, _singles, input.Length - inputValues.Length); 852var bounds = _binFinder.FindBins(numBins, _doubles, input.Length - inputValues.Length); 894var editor = VBufferEditor.Create(ref output, input.Length, inputValues.Length);
PermutationFeatureImportance.cs (4)
59if (slotNames.Length != numSlots) 97if (weights.Length < numSlots) 101zeroWeightsCount += numSlots - weights.Length; 109ch.Info("Number of zero weights: {0} out of {1}.", zeroWeightsCount, weights.Length);
RandomFourierFeaturizing.cs (1)
551Host.Check(src.Length == transformInfo.SrcDim, "column does not have the expected dimensionality.");
SvmLight\SvmLightLoader.cs (4)
305var editor = VBufferEditor.Create(ref output.FeatureKeys, input.FeatureKeys.Length); 366Contracts.Check(keys.Length == values.Length, "number of keys does not match number of values."); 377for (int i = 0; i < keys.Length; ++i)
Text\LdaTransform.cs (5)
338if (mapping.Length == 0) 448actualSize = _ldaTrainer.LoadDocDense(inputValues, termNum, input.Length); 450actualSize = _ldaTrainer.LoadDoc(input.GetIndices(), inputValues, termNum, input.Length); 909if (numVocabs[i] < src.Length) 910numVocabs[i] = src.Length;
Text\NgramHashingTransformer.cs (2)
851Contracts.Assert(vec.Length == 1 << _parent._columns[iinfo].NumberOfBits); 852types[iinfo] = new VectorDataViewType(TextDataViewType.Instance, vec.Length);
Text\NgramTransform.cs (1)
535Host.Check(unigramNames.Length == keyCount);
Text\NgramUtils.cs (2)
79for (int i = 0; i < src.Length; i++) 98for (int i = 0; i < src.Length; i++)
UngroupTransform.cs (2)
648_colSizes[col] = row.Length; 654if (_pivotColPosition >= row.Length)
Microsoft.ML.Vision (4)
DnnRetrainTransform.cs (2)
1090_denseData = new T[_vBuffer.Length]; 1099_position += _vBuffer.Length;
ImageClassificationTrainer.cs (2)
766int length = buffer.Length; 847if (image.Length <= 0)