1221 references to Utils
Microsoft.ML.Core (121)
CommandLine\CharCursor.cs (3)
27_ichLim = Utils.Size(text); 35Contracts.CheckParam(0 <= min && min <= Utils.Size(text), nameof(min)); 36Contracts.CheckParam(min <= lim && lim <= Utils.Size(text), nameof(lim));
CommandLine\CmdParser.cs (12)
1259Arg[] args = Utils.BuildArray(argumentInfo.Args.Length, i => new Arg(argumentInfo.Args[i])); 1272Contracts.Assert(Utils.Size(genArgs) == 1); 1441Contracts.Assert(!IsDefault || Utils.Size(ShortNames) == 0); 1524for (int i = 0; i < Utils.Size(values);) 1542if (Utils.Size(values) > 0) 1570for (int i = 0; i < Utils.Size(values);) 1606for (int i = 0; i < Utils.Size(values);) 1636var res = Array.CreateInstance(ItemType, Utils.Size(values)); 1646var res = Array.CreateInstance(ItemType, Utils.Size(values)); 1712Utils.Add(ref val.Values, new KeyValuePair<string, object>("", newValue)); 1728return Utils.Size(ShortNames) != 0 ? ShortNames[0] : LongName; 2160if (Utils.Size(ShortNames) != 0)
ComponentModel\AssemblyLoadingUtils.cs (1)
25if (Utils.Size(assemblies) > 0)
ComponentModel\ComponentCatalog.cs (8)
209Contracts.Assert(getter == null || Utils.Size(attr.CtorTypes) == 0); 236Contracts.Assert(Utils.Size(ctorArgs) == CtorTypes.Length + ((RequireEnvironment) ? 1 : 0)); 241Contracts.Assert(Utils.Size(ctorArgs) == 0); 269env.Check(Utils.Size(extra) == ExtraArgCount); 276var values = Utils.Concat(prefix.ToArray(), extra); 467var parmTypesWithEnv = Utils.Concat(new Type[1] { typeof(IHostEnvironment) }, parmTypes); 469if (Utils.Size(parmTypes) == 0 && (getter = FindInstanceGetter(instType, loaderType)) != null) 1015int carg = Utils.Size(extra);
ComponentModel\LoadableClassAttribute.cs (1)
168if (Utils.Size(loadNames) == 0)
Data\ModelHeader.cs (3)
307Contracts.Check(Utils.Size(bytes) >= Size); 374Contracts.Check(Utils.Size(bytes) >= Size); 643Contracts.Check(Utils.Size(modelSignature) == 8, "Model signature must be eight characters");
Data\ModelLoadContext.cs (3)
141_ectx.CheckDecode(-1 <= id && id < Utils.Size(Strings)); 153Contracts.CheckDecode(0 <= id && id < Utils.Size(Strings)); 164_ectx.CheckDecode(0 <= id && id < Utils.Size(Strings));
Data\ModelLoading.cs (1)
296return Utils.Concat(args1, args2);
Data\ModelSaveContext.cs (1)
164using (var writer = Utils.OpenWriter(ent.Stream))
Data\ProgressReporter.cs (1)
77int n = Utils.Size(values);
Data\Repository.cs (2)
262_ectx.Check(Utils.Size(pathEnt) > 0); 298using (var writer = Utils.OpenWriter(ent.Stream))
Data\RoleMappedSchema.cs (4)
166Contracts.Assert(Utils.Size(kvp.Value) > 0); 306if (Utils.Size(infos) != 1) 307throw Contracts.Except("Expected exactly one column with role '{0}', but found {1}.", role.Value, Utils.Size(infos)); 316Contracts.Assert(Utils.Size(kvp.Value) > 0);
EntryPoints\EntryPointUtils.cs (1)
44return Utils.MarshalInvoke(_isValueWithinRangeMethodInfo, range.Type, range, val);
Utilities\BigArray.cs (20)
14/// <see cref="Utils.ArrayMaxSize"/> many entries, up to 0x7FEFFFFF00000L. 35private const long MaxSize = (long)Utils.ArrayMaxSize << BlockSizeBits; 104Contracts.Assert(longBlockCount <= Utils.ArrayMaxSize); 226Contracts.Assert(0 < longBlockCount && longBlockCount <= Utils.ArrayMaxSize); 244int curLastBlockSize = Utils.Size(_entries[curBlockCount - 1]); 296Contracts.Assert(Utils.Size(_entries) == 0); 304Contracts.Assert(0 < miLim && miLim <= Utils.Size(_entries[maMax])); 305if (Utils.Size(_entries[maMax]) != miLim) 332Utils.EnsureSize(ref _entries, maMax + 1, BlockSize); 338Utils.EnsureSize(ref _entries[maMax], maMax >= FullAllocationBeyond ? BlockSize : miLim, BlockSize); 344Utils.EnsureSize(ref _entries[maMin], BlockSize, BlockSize); 348Utils.EnsureSize(ref _entries[maMax], maMax >= FullAllocationBeyond ? BlockSize : miLim, BlockSize); 356Utils.EnsureSize(ref _entries[maMin], BlockSize, BlockSize); 371Utils.EnsureSize(ref _entries[maMax], maMax >= FullAllocationBeyond ? BlockSize : miLim, BlockSize); 407Contracts.Assert(miLim <= Utils.Size(_entries[maMax])); 413Contracts.Assert(BlockSize <= Utils.Size(_entries[maMin])); 415Contracts.Assert(miLim <= Utils.Size(_entries[maMax])); 423Contracts.Assert(BlockSize <= Utils.Size(_entries[maMin])); 429Contracts.Assert(BlockSize <= Utils.Size(_entries[major])); 436Contracts.Assert(miLim <= Utils.Size(_entries[maMax]));
Utilities\BinFinder.cs (10)
38if (Utils.Size(_path) < CountBins + 1) 43if (Utils.Size(_valuesSng) < numValues) 116if (Utils.Size(_path) < CountBins + 1) 121if (Utils.Size(_valuesDbl) < numValues) 337if (Utils.Size(_accum) < CountValues + 1) 393int split = Utils.FindIndexSorted(_accum, min, max, key); 575if (Utils.Size(_accum) < CountValues + 1) 586if (Utils.Size(_energies) < sizeEnergy) 592if (Utils.Size(_pathInfo) < sizeInfo) 594if (Utils.Size(_cols) < width)
Utilities\FixedSizeQueue.cs (1)
33Contracts.Assert(Utils.Size(_array) >= 0);
Utilities\FloatUtils.cs (4)
100int cbitShift = Utils.CbitHighZero(man) - CbitExp; 203Bits &= ~Utils.UuMaskBelow(-exp); 293int cbitShift = Utils.CbitHighZero(man) - CbitExp; 396Bits &= ~Utils.UMaskBelow(-exp);
Utilities\HashArray.cs (6)
65Contracts.Assert(0 <= _ct && _ct <= Utils.Size(_entries)); 69Contracts.Assert(Utils.Size(_rgit) >= _ct || Utils.Size(_rgit) == HashHelpers.MaxPrimeArrayLength); 153if (_ct >= Utils.Size(_entries)) 155Contracts.Assert(_ct == Utils.Size(_entries)); 156Utils.EnsureSize(ref _entries, _ct + 1);
Utilities\Hashing.cs (4)
59return Utils.GetLo(uu) + Utils.GetHi(uu); 277Contracts.Assert(0 <= ichMin && ichMin <= ichLim && ichLim <= Utils.Size(data)); 346Contracts.Check(lim <= Utils.Size(data));
Utilities\HybridMemoryStream.cs (4)
52if (!(0 <= maxLen && maxLen <= Utils.ArrayMaxSize)) 53throw Contracts.ExceptParam(nameof(maxLen), "must be in range [0,{0}]", Utils.ArrayMaxSize); 72if (!(0 <= maxLen && maxLen <= Utils.ArrayMaxSize)) 73throw Contracts.ExceptParam(nameof(maxLen), "must be in range [0,{0}]", Utils.ArrayMaxSize);
Utilities\MathUtils.cs (1)
706Contracts.Assert(Utils.Size(src) >= count);
Utilities\NormStr.cs (12)
74Contracts.Assert(Utils.IsPowerOfTwo(_mask + 1)); 76Contracts.Assert(0 <= _cns && _cns <= Utils.Size(_rgns)); 77Contracts.Assert(Utils.Size(_rgns) == Utils.Size(_rgmeta)); 106if ((int)Utils.GetLo(meta) == str.Length) 112ins = (int)Utils.GetHi(meta); 129if ((int)Utils.GetLo(meta) == str.Length) 135ins = (int)Utils.GetHi(meta); 182if ((int)Utils.GetLo(meta) == cch) 194ins = (int)Utils.GetHi(meta); 235_rgmeta[_cns] = Utils.MakeUlong((uint)_rgins[iins], (uint)ns.Value.Length); 272_rgmeta[ins] = Utils.MakeUlong((uint)_rgins[iins], (uint)ns.Value.Length);
Utilities\PathUtils.cs (1)
28string path = typeof(Utils).Assembly.Location;
Utilities\ResourceManagerUtils.cs (3)
204var envDir = Environment.GetEnvironmentVariable(Utils.CustomSearchDirEnvVariable); 225$"'{Utils.CustomSearchDirEnvVariable}' environment variable to a writable folder"; 243$"'{Utils.CustomSearchDirEnvVariable}' environment variable to a writable folder";
Utilities\Stream.cs (3)
149Contracts.Assert(0 <= count && count <= Utils.Size(values)); 162Contracts.Assert(0 <= count && count <= Utils.Size(values)); 272var numBits = Utils.Size(arr);
Utilities\SupervisedBinFinder.cs (2)
107Contracts.Assert(Utils.Size(boundaries) > 0); 185Contracts.Assert(Utils.Size(boundaries) > 0);
Utilities\Utils.cs (5)
601if (Utils.Size(values) <= 1) 627if (Utils.Size(values) <= 1) 653if (Utils.Size(values) <= 1) 904int cv = Utils.Size(a); 925return EnsureSize(ref array, min, Utils.ArrayMaxSize, keepOld);
Utilities\VBufferUtils.cs (4)
317if (dstValuesCount > 0 && Utils.TryFindIndexSorted(editor.Indices, 0, dstValuesCount, slot, out idx)) 417Utils.FillIdentity(newIndicesEditor.Indices, denseCount); 422int lim = Utils.FindIndexSorted(dstIndices, 0, dstValues.Length, denseCount); 1353Contracts.CheckParam(0 <= length && length <= Utils.Size(src), nameof(length));
Microsoft.ML.Core.Tests (75)
UnitTests\CoreBaseTestClass.cs (2)
292Fail("{0} id collisions among {1} items", idCollisions, Utils.Size(idsSeen) + idCollisions); 298if (!Utils.Add(ref idsSeen, id))
UnitTests\TestEntryPoints.cs (6)
2232using (var writer = Utils.OpenWriter(file)) 2242using (var writer = Utils.OpenWriter(file)) 3176Env.Assert(Utils.Size(xfNames) == Utils.Size(xfArgs)); 3209for (int i = 0; i < Utils.Size(xfNames); i++) 3277for (int i = 0; i < Utils.Size(xfNames); i++)
UnitTests\TestResourceDownload.cs (4)
31var resourcePathVarOld = Environment.GetEnvironmentVariable(Utils.CustomSearchDirEnvVariable); 32Environment.SetEnvironmentVariable(Utils.CustomSearchDirEnvVariable, null); 128$"MICROSOFTML_RESOURCE_PATH is set to {Environment.GetEnvironmentVariable(Utils.CustomSearchDirEnvVariable)}"); 138Environment.SetEnvironmentVariable(Utils.CustomSearchDirEnvVariable, resourcePathVarOld);
UnitTests\TestUtilities.cs (56)
28Assert.True(Utils.IsMonotonicallyIncreasing(x)); 35Assert.True(Utils.IsMonotonicallyIncreasing(x)); 41Assert.False(Utils.IsMonotonicallyIncreasing(x)); 46Assert.True(Utils.IsMonotonicallyIncreasing(nullX)); 55Assert.True(Utils.IsMonotonicallyIncreasing(x)); 62Assert.True(Utils.IsMonotonicallyIncreasing(x)); 68Assert.False(Utils.IsMonotonicallyIncreasing(x)); 75Assert.False(Utils.IsMonotonicallyIncreasing(x)); 80Assert.True(Utils.IsMonotonicallyIncreasing(nullX)); 89Assert.True(Utils.IsMonotonicallyIncreasing(x)); 96Assert.True(Utils.IsMonotonicallyIncreasing(x)); 102Assert.False(Utils.IsMonotonicallyIncreasing(x)); 109Assert.False(Utils.IsMonotonicallyIncreasing(x)); 114Assert.True(Utils.IsMonotonicallyIncreasing(nullX)); 123Assert.True(Utils.IsIncreasing(0, x, 10)); 125Assert.False(Utils.IsIncreasing(1, x, 10)); 127Assert.False(Utils.IsIncreasing(0, x, 9)); 129Assert.True(Utils.IsIncreasing(0, x, 0, 10)); 130Assert.True(Utils.IsIncreasing(0, x, 1, 10)); 131Assert.True(Utils.IsIncreasing(0, x, 5, 10)); 132Assert.True(Utils.IsIncreasing(0, x, 10, 10)); 134Assert.Throws<InvalidOperationException>(() => Utils.IsIncreasing(0, x, 11, 10)); 139Assert.False(Utils.IsIncreasing(0, x, 10)); 141Assert.True(Utils.IsIncreasing(0, x, 7, 10)); 146Assert.False(Utils.IsIncreasing(0, x, 10)); 148Assert.True(Utils.IsIncreasing(0, x, 7, 10)); 153Assert.True(Utils.IsIncreasing(0, nullX, 10)); 156Assert.Throws<InvalidOperationException>(() => Utils.IsIncreasing(0, nullX, 7, 10)); 166Assert.True(Utils.AreEqual(x, y)); 171Assert.False(Utils.AreEqual(x, y)); 177Assert.False(Utils.AreEqual(x, y)); 183Assert.False(Utils.AreEqual(x, y)); 188Assert.False(Utils.AreEqual(xOfDifferentLength, y)); 191Assert.False(Utils.AreEqual(null, y)); 192Assert.False(Utils.AreEqual(x, null)); 202Assert.True(Utils.AreEqual(x, y)); 207Assert.False(Utils.AreEqual(x, y)); 213Assert.False(Utils.AreEqual(x, y)); 219Assert.False(Utils.AreEqual(x, y)); 224Assert.False(Utils.AreEqual(xOfDifferentLength, y)); 227Assert.False(Utils.AreEqual(null, y)); 228Assert.False(Utils.AreEqual(x, null)); 238Assert.True(Utils.AreEqual(x, y)); 243Assert.False(Utils.AreEqual(x, y)); 249Assert.False(Utils.AreEqual(x, y)); 255Assert.False(Utils.AreEqual(x, y)); 260Assert.False(Utils.AreEqual(xOfDifferentLength, y)); 263Assert.False(Utils.AreEqual(null, y)); 264Assert.False(Utils.AreEqual(x, null)); 274Assert.True(Utils.AreEqual(x, y)); 279Assert.False(Utils.AreEqual(x, y)); 285Assert.False(Utils.AreEqual(x, y)); 291Assert.False(Utils.AreEqual(x, y)); 296Assert.False(Utils.AreEqual(xOfDifferentLength, y)); 299Assert.False(Utils.AreEqual(null, y)); 300Assert.False(Utils.AreEqual(x, null));
UnitTests\TestVBuffer.cs (7)
945Utils.Swap(ref a, ref dst); 996Contracts.Assert(Utils.Size(indices) >= count); 1003Assert.True(Utils.IsIncreasing(0, indices, count, len)); 1114Utils.Swap(ref a, ref b); 1133Utils.Swap(ref a, ref b); 1147Utils.Shuffle(rgen, aEditor.Indices); 1156Utils.Swap(ref a, ref b);
Microsoft.ML.Data (449)
Commands\CrossValidationCommand.cs (2)
111Utils.CheckOptionalUserDirectory(ImplOptions.SummaryFilename, nameof(ImplOptions.SummaryFilename)); 112Utils.CheckOptionalUserDirectory(ImplOptions.OutputDataFile, nameof(ImplOptions.OutputDataFile));
Commands\DataCommand.cs (2)
94Utils.CheckOptionalUserDirectory(options.OutputModelFile, nameof(options.OutputModelFile)); 291if (Utils.Size(ImplOptions.Transforms) > 0)
Commands\EvaluateCommand.cs (2)
208Utils.CheckOptionalUserDirectory(ImplOptions.SummaryFilename, nameof(ImplOptions.SummaryFilename)); 209Utils.CheckOptionalUserDirectory(ImplOptions.OutputDataFile, nameof(ImplOptions.OutputDataFile));
Commands\SaveDataCommand.cs (2)
46Utils.CheckOptionalUserDirectory(args.OutputDataFile, nameof(args.OutputDataFile)); 136if (Utils.Size(keepColumns) > 0)
Commands\SavePredictorCommand.cs (9)
71Utils.CheckOptionalUserDirectory(_args.BinaryFile, nameof(_args.BinaryFile)); 72Utils.CheckOptionalUserDirectory(_args.CodeFile, nameof(_args.CodeFile)); 73Utils.CheckOptionalUserDirectory(_args.IniFile, nameof(_args.IniFile)); 74Utils.CheckOptionalUserDirectory(_args.SummaryFile, nameof(_args.SummaryFile)); 75Utils.CheckOptionalUserDirectory(_args.TextFile, nameof(_args.TextFile)); 164using (StreamWriter writer = Utils.OpenWriter(summaryModelStream)) 172using (StreamWriter writer = Utils.OpenWriter(textModelStream)) 180using (StreamWriter writer = Utils.OpenWriter(iniModelStream)) 196using (StreamWriter writer = Utils.OpenWriter(codeModelStream))
Commands\ScoreCommand.cs (5)
87Utils.CheckOptionalUserDirectory(ImplOptions.OutputDataFile, nameof(ImplOptions.OutputDataFile)); 162|| (ImplOptions.OutputAllColumns == null && Utils.Size(ImplOptions.OutputColumns) == 0 && outputIsBinary); 165ImplOptions.OutputAllColumns == true || Utils.Size(ImplOptions.OutputColumns) == 0; 167if (ImplOptions.OutputAllColumns == true && Utils.Size(ImplOptions.OutputColumns) != 0) 170if (!outputAllColumns && Utils.Size(ImplOptions.OutputColumns) != 0)
Commands\TestCommand.cs (2)
67Utils.CheckOptionalUserDirectory(ImplOptions.SummaryFilename, nameof(ImplOptions.SummaryFilename)); 68Utils.CheckOptionalUserDirectory(ImplOptions.OutputDataFile, nameof(ImplOptions.OutputDataFile));
Commands\TrainCommand.cs (1)
374using (var writer = Utils.OpenWriter(ent.Stream))
Commands\TrainTestCommand.cs (2)
88Utils.CheckOptionalUserDirectory(args.SummaryFilename, nameof(args.SummaryFilename)); 89Utils.CheckOptionalUserDirectory(args.OutputDataFile, nameof(args.OutputDataFile));
Commands\TypeInfoCommand.cs (5)
95var info = Utils.MarshalInvoke(_kindReportMethodInfo, this, types[i].RawType, ch, types[i]); 106Utils.Add(ref nonIdentity, types[i].GetRawKind()); 124ch.Assert(Utils.Size(dsts) >= 1); 125ch.Assert(Utils.Size(srcs) >= 1); 132if (Utils.Size(nonIdentity) > 0)
Data\BufferBuilder.cs (2)
84Contracts.Assert(Utils.Size(_indices) >= _count); 370int iv = Utils.FindIndexSorted(_indices, 0, _count, ifeat);
Data\Conversion.cs (1)
576return Utils.MarshalInvoke(_getKeyParseMethodInfo, this, key.RawType, key);
Data\DataViewUtils.cs (17)
128host.Check(Utils.Size(inputs) > 0); 225if (Utils.Size(cursors) == 0) 343Utils.BuildSubsetMaps(schema, cursor.IsColumnActive, out activeToCol, out colToActive); 348if (Utils.Size(ourPools) != schema.Count) 376workers[t] = Utils.RunOnBackgroundThreadAsync(() => 485return Utils.MarshalInvoke(_getPoolCoreMethodInfo, type.RawType, pools, poolIdx); 524Utils.BuildSubsetMaps(_schema, input.IsColumnActive, out activeToCol, out colToActive); 542Utils.MarshalInvoke(_createInPipeMethodInfo, this, column.Type.RawType, input, activeToCol[c]); 560Task thread = Utils.RunOnBackgroundThreadAsync( 721Utils.EnsureSize(ref _values, Count + 1, keepOld: true); 765Contracts.Assert(Utils.Size(values) >= count); 833Contracts.Assert(Utils.Size(pipes) == _batchColumns.Length); 939Contracts.Assert(_count <= Utils.Size(Values)); 1189Utils.BuildSubsetMaps(_schema, _cursors[0].IsColumnActive, out _activeToCol, out _colToActive); 1244return Utils.MarshalInvoke(_createGetterMethodInfo, this, Schema[col].Type.RawType, col); 1341getter = Utils.MarshalInvoke(GetVectorFlatteningGetter<int>, vectorType.ItemType.RawType, 1346getter = Utils.MarshalInvoke(GetSingleValueGetter<int>, colType.RawType,
Data\RowCursorUtils.cs (4)
39return Utils.MarshalInvoke(_getGetterAsDelegateCoreMethodInfo, row.Schema[col].Type.RawType, row, col); 129return Utils.MarshalInvoke(GetGetterAsStringBuilderCore<int>, typeSrc.RawType, typeSrc, row, col); 310return Utils.MarshalInvoke(_getIsNewGroupDelegateCoreMethodInfo, type.RawType, cursor, col); 528bool[] active = Utils.BuildArray(Schema.Count, columnNeeded);
Data\SchemaDefinition.cs (1)
458if (Utils.Size(dims) == 0)
DataDebuggerPreview.cs (1)
48setters[i] = Utils.MarshalInvoke(_makeSetterMethodInfo, this, data.Schema[i].Type.RawType, cursor, i);
DataLoadSave\Binary\BinaryLoader.cs (14)
650if (Utils.Size(metadataArray) > 0) 786_host.Assert(_outputSchema.Count == Utils.Size(_aliveColumns)); 788if (Utils.Size(_deadColumns) > 0) 789ch.Warning("BinaryLoader does not know how to interpret {0} columns", Utils.Size(_deadColumns)); 874ch.Assert(_outputSchema.Count == Utils.Size(_aliveColumns)); 876if (Utils.Size(_deadColumns) > 0) 877ch.Warning("BinaryLoader does not know how to interpret {0} columns", Utils.Size(_deadColumns)); 951_host.Assert(Utils.Size(unsavable) == 0); 1256Utils.BuildSubsetMaps(toc.Length, columnsNeeded, out activeIndices, out _colToActivesIndex); 1283_blockShuffleOrder = rand == null || _numBlocks == 0 ? null : Utils.GetRandomPermutation(rand, _numBlocks); 1309_readerThread = Utils.RunOnBackgroundThreadAsync(ReaderWorker); 1388pipeWorkers[w] = Utils.RunOnBackgroundThreadAsync(() => 1464Ectx.Assert(0 <= columnIndex && columnIndex < Utils.Size(parent._actives)); 2052=> Utils.MarshalInvoke(_noRowGetterMethodInfo, this, type.RawType);
DataLoadSave\Binary\BinarySaver.cs (10)
315expectedPosition += Utils.Leb128IntLength((ulong)metadataInfos.Count); 327expectedPosition += Utils.Leb128IntLength((ulong)stringLen) + stringLen; 341expectedPosition += Utils.Leb128IntLength((ulong)blockSize); 518expectedPosition += Utils.Leb128IntLength((uint)nameLen) + nameLen; 528expectedPosition += Utils.Leb128IntLength((uint)rowsPerBlock); 670compressionThreads[i] = Utils.RunOnBackgroundThreadAsync( 678Task writeThread = Utils.RunOnBackgroundThreadAsync( 712ColumnCodec[] activeSourceColumns = new ColumnCodec[Utils.Size(colIndices)]; 713if (Utils.Size(colIndices) == 0) 895value = Utils.MarshalInvoke(_loadValueMethodInfo, this, type.RawType, stream, codec);
DataLoadSave\Binary\CodecFactory.cs (2)
128bytes = checked(bytes + Utils.Leb128IntLength((uint)bytes)); 134bytes = checked(bytes + Utils.Leb128IntLength((uint)mem.Length) + output);
DataLoadSave\Binary\Codecs.cs (12)
98Contracts.Assert(0 <= index && index <= Utils.Size(values)); 99Contracts.Assert(0 <= count && count <= Utils.Size(values) - index); 262Contracts.Assert(0 <= index && index <= Utils.Size(values)); 263Contracts.Assert(0 <= count && count <= Utils.Size(values) - index); 693Contracts.Assert(Utils.Size(_offsets) == Utils.Size(_ticks)); 725Utils.EnsureSize(ref _offsets, _entries, false); 730Utils.EnsureSize(ref _ticks, _entries, false); 902long structureLength = sizeof(int) * (2 + (long)Utils.Size(_lengths) + _counts.Count + 1 + _indices.Count); 1034Utils.EnsureSize(ref values, totalItems, false); 1058Utils.EnsureSize(ref values, count, false); 1135if (Utils.Size(dims) > 0)
DataLoadSave\Binary\MemoryStreamPool.cs (1)
56return Math.Max(Utils.IbitHigh((uint)maxSize) - 15, 0);
DataLoadSave\Database\DatabaseLoader.cs (3)
51if (Utils.Size(cols) == 0) 421var order = Utils.GetIdentityPermutation(segs.Length); 723var active = Utils.BuildArray(_loader._bindings.OutputSchema.Count, columnsNeeded);
DataLoadSave\Database\DatabaseLoaderCursor.cs (1)
173return Utils.MarshalInvoke(_createGetterDelegateMethodInfo, this, _bindings.Infos[col].ColType.RawType, col);
DataLoadSave\DataOperationsCatalog.cs (2)
197int[] prefetch = new int[Utils.Size(columnsToPrefetch)]; 286_env.CheckUserArg(Utils.Size(columns) > 0, nameof(columns));
DataLoadSave\EstimatorChain.cs (4)
33Contracts.Assert(Utils.Size(estimators) == Utils.Size(scopes)); 34Contracts.Assert(Utils.Size(estimators) == Utils.Size(needCacheAfter));
DataLoadSave\EstimatorExtensions.cs (1)
156T[] result = new T[Utils.Size(array) + 1];
DataLoadSave\FakeSchema.cs (2)
37del = Utils.MarshalInvoke(_getDefaultVectorGetterMethodInfo, vectorType.ItemType.RawType); 39del = Utils.MarshalInvoke(_getDefaultGetterMethodInfo, metaColumnType.RawType);
DataLoadSave\LegacyCompositeDataLoader.cs (3)
130if (Utils.Size(transformArgs) == 0) 185if (Utils.Size(tagData) == 0) 215int count = Utils.Size(tagData);
DataLoadSave\Text\TextLoader.cs (14)
198if (Utils.Size(Source) == 0) 239if (Utils.Size(Source) == 0) 549return Utils.Size(Columns) == 0 || Columns.All(x => x.IsValid()); 640var order = Utils.GetIdentityPermutation(segs.Length); 718if (Utils.Size(col.Source) == 0) 738if (Utils.Size(lines) > 0) 782ch.Assert(Utils.Size(col.Source) > 0); 896if ((parent.HasHeader || headerFile != null) && Utils.Size(lines) > 0) 1166if (Utils.Size(cols) == 0 && !TryParseSchema(_host, headerFile ?? dataSample, ref options, out cols, out error)) 1179_host.Assert(Utils.Size(cols) > 0); 1372if (Utils.Size(cols) == 0) 1447host.CheckDecode(Utils.Size(_separators) > 0); 1665var active = Utils.BuildArray(_loader._bindings.OutputSchema.Count, columnsNeeded); 1672var active = Utils.BuildArray(_loader._bindings.OutputSchema.Count, columnsNeeded);
DataLoadSave\Text\TextLoaderCursor.cs (5)
224if (Utils.Size(batch.Infos) == 0) 233Utils.Add(ref lines, batch.Infos[i].Text.AsMemory()); 440_thdRead = Utils.RunOnBackgroundThreadAsync(ThreadProc); 806Contracts.Assert(0 <= index && index < Utils.Size(infos)); 921_threads[tid] = Utils.RunOnBackgroundThreadAsync(ThreadProc, tid);
DataLoadSave\Text\TextLoaderParser.cs (7)
81return Utils.MarshalInvoke(_getCreatorOneCoreMethodInfo, this, type.RawType, type); 94return Utils.MarshalInvoke(_getCreatorVecCoreMethodInfo, this, type.RawType, type); 108return Utils.MarshalInvoke(_getCreatorOneCoreMethodInfo, this, key.RawType, key); 114return Utils.MarshalInvoke(_getCreatorVecCoreMethodInfo, this, key.RawType, key); 865Contracts.Assert(active == null || Utils.Size(active) == _infos.Length); 1367Contracts.Assert(active == null || Utils.Size(active) == _infos.Length); 1460Contracts.Assert(Utils.Size(info.Segments) == 1);
DataLoadSave\Text\TextSaver.cs (1)
349using (var writer = Utils.OpenWriter(stream))
DataLoadSave\TransformerChain.cs (1)
106if (Utils.Size(transformers) == 0)
DataLoadSave\Transpose\TransposeLoader.cs (3)
554ctx.SaveBinaryStream("Schema.idv", w => saver.SaveData(w.BaseStream, noRows, Utils.GetIdentityPermutation(schema.Count))); 653return Utils.MarshalInvoke(_getSlotCursorCoreMethodInfo, this, cursorType.RawType, inputCursor); 770Utils.BuildSubsetMaps(_parent._header.ColumnCount, columnsNeeded, out _actives, out _colToActivesIndex);
DataLoadSave\Transpose\TransposeSaver.cs (1)
136_internalSaver.SaveData(substream, view, Utils.GetIdentityPermutation(view.Schema.Count));
DataView\AppendRowsDataView.cs (3)
184return Utils.MarshalInvoke(_createTypedGetterMethodInfo, this, colType.RawType, col); 421_ectx.Assert(Utils.Size(counts) > 0); 456Utils.Shuffle(_rand, _batch.AsSpan(0, _batchEnd));
DataView\ArrayDataViewBuilder.cs (6)
282_indices = Utils.GetRandomPermutation(rand, view._rowCount); 468if (Utils.Size(values) > 0) 503: base(itemType, values, Utils.Size) 509VBuffer<T>.Copy(src, 0, ref dst, Utils.Size(src)); 518: base(itemType, values, Utils.Size) 525var length = Utils.Size(src);
DataView\CacheDataView.cs (26)
95if (_rowCount > Utils.ArrayMaxSize) 96throw _host.Except("The input data view has too many ({0}) rows. CacheDataView can only cache up to {1} rows", _rowCount, Utils.ArrayMaxSize); 102if (Utils.Size(prefetch) > 0) 145Utils.Add(ref columnsToDrop, c); 157prefetch[ip++] -= Utils.Size(columnsToDrop); 159inputToSubset[c] = c - Utils.Size(columnsToDrop); 164if (Utils.Size(columnsToDrop) == 0) 238if (rc > Utils.ArrayMaxSize) 240return Utils.GetRandomPermutation(rand, (int)_rowCount); 341Utils.Add(ref taskColumns, c); 345if (Utils.Size(taskColumns) == 0 && _cacheDefaultWaiter != null) 353caches = new ColumnCache[Utils.Size(taskColumns)]; 367var fillerThread = Utils.RunOnBackgroundThreadAsync(() => Filler(cursor, caches, waiter)); 402if (rowCount > Utils.ArrayMaxSize) 403throw _host.Except("The input data view has too many ({0}) rows. CacheDataView can only cache up to {1} rows", rowCount, Utils.ArrayMaxSize); 417if (_rowCount > Utils.ArrayMaxSize) 418throw _host.Except("The input data view has too many ({0}) rows. CacheDataView can only cache up to {1} rows", _rowCount, Utils.ArrayMaxSize); 1165Utils.BuildSubsetMaps(colLim, predicate, out actives, out _colToActivesIndex); 1221return Utils.MarshalInvoke(_createGetterDelegateMethodInfo, this, Schema[col].Type.RawType, col); 1372Utils.EnsureSize(ref _indexBoundaries, rowCount + 1); 1373Utils.EnsureSize(ref _valueBoundaries, rowCount + 1); 1379Utils.EnsureSize(ref _lengths, rowCount); 1388Ctx.Assert((idx + 1) < Utils.Size(_indexBoundaries)); 1389Ctx.Assert((idx + 1) < Utils.Size(_valueBoundaries)); 1390Ctx.Assert(_uniformLength > 0 || idx < Utils.Size(_lengths)); 1443Utils.EnsureSize(ref _values, _rowCount + 1);
DataView\CompositeRowToRowMapper.cs (2)
36InnerMappers = Utils.Size(mappers) > 0 ? mappers : _empty; 38OutputSchema = Utils.Size(mappers) > 0 ? mappers[mappers.Length - 1].OutputSchema : inputSchema;
DataView\DataViewConstructionUtils.cs (11)
86var info = Utils.MarshalInvoke(_getAnnotationInfoMethodInfo, annotation.Type.RawType, annotation.Name, annotations); 290return Utils.MarshalInvoke(_createKeyGetterDelegateMethodInfo, this, keyRawType, peek, colType); 302return Utils.MarshalInvoke(del, this, genericType, peek); 316var n = Utils.Size(buf); 344var n = Utils.Size(buf); 643_permutation = Utils.GetRandomPermutation(rand, dataView._data.Count); 934return Utils.MarshalInvoke(_getArrayGetterMethodInfo, this, dstItemType) as ValueGetter<TDst>; 950return Utils.MarshalInvoke(_getVBufferGetterMethodInfo, this, annotationVectorType.ItemType.RawType) as ValueGetter<TDst>; 976return Utils.MarshalInvoke(_getGetterCoreMethodInfo, this, AnnotationType.RawType); 982var n = Utils.Size(value); 994var n = Utils.Size(value);
DataView\EmptyDataView.cs (1)
57_active = Utils.BuildArray(Schema.Count, columnsNeeded);
DataView\RowToRowMapperTransform.cs (1)
150var active = Utils.BuildArray(n, predicate);
DataView\SimpleRow.cs (1)
42Contracts.Check(Utils.Size(getters) == schema.Count);
DataView\Transposer.cs (22)
90_host.CheckParam(Utils.Size(columns) > 0, nameof(columns), "Cannot be empty"); 111_inputToTransposed = Utils.CreateArray(schema.Count, -1); 187if (rowCount > Utils.ArrayMaxSize) 188throw _host.ExceptParam(nameof(view), "View has {0} rows, we cannot transpose with more than {1}", rowCount, Utils.ArrayMaxSize); 207host.CheckParam(Utils.Size(columns) > 0, nameof(columns), "Cannot be empty"); 250return Utils.MarshalInvoke(_getSlotCursorCoreMethodInfo, this, type, col); 399Utils.EnsureSize(ref indices, ++count); 401Utils.EnsureSize(ref values, count); 539Utils.EnsureSize(ref _indices, vecLen); 542Utils.EnsureSize(ref _values, vecLen); 545Utils.EnsureSize(ref _counts, vecLen, keepOld: false); 656Utils.EnsureSize(ref _cbuff, vecLen); 699Ch.Assert(0 <= _slotCurr && _slotCurr < Utils.Size(_cbuff) && _cbuff[_slotCurr].Buffer.Length == _len); 929return Utils.MarshalInvoke(_createCoreMethodInfo, type.RawType, view, col); 953Contracts.Assert(Utils.IsIncreasing(1, ends, vectorSize + 1)); 954return Utils.MarshalInvoke(CreateCore<int>, type.GetItemType().RawType, view, col, ends); 1096Contracts.Assert(Utils.Size(lims) >= 2); 1100Contracts.Assert(Utils.IsIncreasing(0, lims, type.Size + 1)); 1274Ch.Assert(Utils.Size(activeSplitters) == slicer._splitters.Length); 1377var getter = Utils.MarshalInvoke(_slotCursorGetGetterMethodInfo, cursor, genTypeArgs[0]) as ValueGetter<TValue>; 1399return Utils.MarshalInvoke(_getRowCursorShimCoreMethodInfo, cursor.GetSlotType().ItemType.RawType, provider, cursor); 1452return Utils.MarshalInvoke(_getRowCursorMethodInfo, this, _type.GetItemType().RawType, hasZero);
DataView\TypedCursor.cs (2)
437if (Utils.Size(buf) != value.Length) 459if (value.Length == Utils.Size(buf) && value.IsDense)
DataView\ZipBinding.cs (1)
75if (!Utils.TryFindIndexSorted(_cumulativeColCounts, 0, _cumulativeColCounts.Length, col, out srcIndex))
DataView\ZipDataView.cs (2)
50_host.Assert(Utils.Size(sources) > 1); 125_isColumnActive = Utils.BuildArray(_zipBinding.ColumnCount, predicate);
Deprecated\Instances\HeaderSchema.cs (3)
82return Create(Utils.Size(names), names); 91int size = Math.Min(count, Utils.Size(names)); 302int size = Math.Min(Utils.Size(names), count);
Deprecated\Vector\VectorUtils.cs (9)
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."); 270int aMin = Utils.FindIndexSorted(aIndices, 0, aIndices.Length, offset); 271int aLim = Utils.FindIndexSorted(aIndices, 0, aIndices.Length, offset + b.Length); 346ia = Utils.FindIndexSorted(aIndices, ia, iaLim, bIndices[ib]); 354ib = Utils.FindIndexSorted(bIndices, ib, ibLim, aIndices[ia]); 417Contracts.Check(Utils.Size(a) == b.Length, "Vectors must have the same dimensionality.");
Dirty\ChooseColumnsByIndexTransform.cs (1)
155return Utils.BuildArray(OutputSchema.Count, predicate);
Dirty\PredictionUtils.cs (3)
54if (Utils.Size(extraSettings) == 0) 56if (Utils.Size(settings) == 0) 66if (Utils.Size(args) == 0)
EntryPoints\EntryPointNode.cs (2)
538if (!string.IsNullOrEmpty(colName) && Utils.Size(_entryPoint.InputKinds) > 0 && 539(Utils.Size(inputKinds) == 0 || _entryPoint.InputKinds.Intersect(inputKinds).Any()))
EntryPoints\InputBuilder.cs (3)
463return Utils.MarshalInvoke(makeArray, type.GetElementType(), ectx, ja, attributes, catalog); 481return Utils.MarshalInvoke(makeDict, type.GetGenericArguments()[1], ectx, (JObject)value, attributes, catalog); 640return Utils.MarshalInvoke(creator, outerType.GetGenericArguments()[0], innerValue);
EntryPoints\TransformModelImpl.cs (1)
93if (Utils.Size(xfs) > 0)
Evaluators\AnomalyDetectionEvaluator.cs (1)
148bool hasStrats = Utils.Size(dictionaries) > 0;
Evaluators\BinaryClassifierEvaluator.cs (5)
163return i => Utils.Size(prob) > 0 && i == prob[0].Index || pred(i); 198var probCol = Utils.Size(probInfos) > 0 ? probInfos[0].Name : null; 250bool hasStrats = Utils.Size(dictionaries) > 0; 574Host.Assert(Utils.Size(classNames) == 2); 1326Utils.CheckOptionalUserDirectory(args.PRFilename, nameof(args.PRFilename));
Evaluators\ClusteringEvaluator.cs (3)
169bool hasStrats = Utils.Size(dictionaries) > 0; 339Contracts.Assert(Utils.Size(scores) == _numClusters); 340Contracts.Assert(Utils.Size(indices) == _numClusters);
Evaluators\EvaluatorBase.cs (8)
80var stratIndices = Utils.Size(stratCols) > 0 ? new HashSet<int>(stratCols.Select(col => col.Index)) : new HashSet<int>(); 114if (Utils.Size(stratCols) > 0) 152for (int i = 0; i < Utils.Size(dictionaries); i++) 166for (int i = 0; i < Utils.Size(dictionaries); i++) 183for (int i = 0; i < Utils.Size(dictionaries); i++) 208if (Utils.Size(dictionaries) == 0) 307if (Utils.Size(warnings) > 0) 375return Utils.MarshalInvoke(CreateDictionary<int>, stratType.RawType, schema, stratCol, stratType, createAgg);
Evaluators\EvaluatorUtils.cs (11)
405return Utils.MarshalInvoke(AddTextColumn<int>, inputColType.RawType, env, 447return Utils.MarshalInvoke(AddKeyColumn<int>, inputColType.RawType, env, 512Contracts.Assert(src.Length == Utils.Size(map)); 536Contracts.Assert(src.Length == Utils.Size(map)); 613var keyValueMappers = Utils.MarshalInvoke(MapKeys<int>, keyValueType.RawType, views.Select(view => view.Schema).ToArray(), columnName, false, indices, keyNames); 681var keyValueMappers = Utils.MarshalInvoke(MapKeys<int>, keyValueType.RawType, views.Select(view => view.Schema).ToArray(), columnName, true, columnIndices, keyNames); 933idv = Utils.MarshalInvoke(AddVarLengthColumn<int>, vectorType.ItemType.RawType, env, idv, 996ch.Assert(Utils.Size(getters) == schema.Count); 997ch.Assert(Utils.Size(vBufferGetters) == schema.Count); 1065if (Utils.Size(nonAveragedCols) > 0) 1408var tempPerm = Utils.GetRandomPermutation(host.Rand, labelNames.Length);
Evaluators\MulticlassClassificationEvaluator.cs (5)
112Host.Assert(Utils.Size(score) == 1); 158bool hasStrats = Utils.Size(dictionaries) > 0; 402Host.Assert(Utils.Size(classNames) == scoreVectorSize); 630_classNames = Utils.BuildArray(_numClasses, i => i.ToString().AsMemory()); 658_classNames = Utils.BuildArray(_numClasses, i => i.ToString().AsMemory());
Evaluators\MultiOutputRegressionEvaluator.cs (1)
109bool hasStrats = Utils.Size(dictionaries) > 0;
Evaluators\RankingEvaluator.cs (4)
174bool hasStrats = Utils.Size(dictionaries) > 0; 881Utils.CheckOptionalUserDirectory(args.GroupSummaryFilename, nameof(args.GroupSummaryFilename)); 999Contracts.Assert(Utils.Size(groupMaxDcgCur) == truncationLevel); 1040int[] permutation = Utils.GetIdentityPermutation(count);
Evaluators\RegressionEvaluatorBase.cs (1)
62bool hasStrats = Utils.Size(dictionaries) > 0;
Model\Pfa\PfaUtils.cs (1)
148Contracts.CheckParam(Utils.Size(types) >= 2, nameof(types), "Union must have at least two types");
Model\Pfa\SavePfaCommand.cs (1)
69Utils.CheckOptionalUserDirectory(args.Pfa, nameof(args.Pfa));
Prediction\Calibrator.cs (10)
703getters[column.Index] = Utils.MarshalInvoke(_getPredictorGetterMethodInfo, this, type.RawType, predictorRow, column.Index); 785Host.CheckParam(Utils.Size(outputs) == 2, nameof(outputs), "Expected this to have two outputs"); 794Host.CheckParam(Utils.Size(outputs) == 2, nameof(outputs), "Expected this to have two outputs"); 1237_host.CheckDecode(Utils.Size(_binProbs) > 0); 1298_host.Check(Utils.Size(outputNames) == 2); 1414Utils.EnsureSize(ref _data, _itemsSeen, _capacity); 1796_host.Check(Utils.Size(scoreProbablityColumnNames) == 2); 1981_host.Assert(Utils.IsMonotonicallyIncreasing(mins)); 1982_host.Assert(Utils.IsMonotonicallyIncreasing(maxes)); 1983_host.Assert(Utils.IsMonotonicallyIncreasing(values));
Scorers\BinaryClassifierScorer.cs (2)
72return Utils.MarshalInvoke(WrapCore<int>, keyType.ItemType.RawType, env, mapper, trainSchema); 285Contracts.CheckParam(Utils.Size(mapperOutputs) >= 1, nameof(mapperOutputs));
Scorers\ClusteringScorer.cs (1)
131Contracts.Assert(Utils.Size(mapperOutputs) == 1);
Scorers\FeatureContributionCalculation.cs (2)
211return Utils.MarshalInvoke(_getValueGetterMethodInfo, this, typeSrc.RawType, input, colSrc); 239var indices = contributions.IsDense ? Utils.GetIdentityPermutation(contributions.Length) : editor.Indices;
Scorers\MulticlassClassificationScorer.cs (5)
145_getter = Utils.MarshalInvoke(_decodeInitMethodInfo, this, _type.ItemType.RawType, value); 187Utils.MarshalActionInvoke(SaveCore<int>, _type.ItemType.RawType, ctx); 235return Utils.MarshalInvoke(CreateBound<int>, _type.ItemType.RawType, env, (ISchemaBoundRowMapper)innerBound, _type, _getter, _metadataKind, _canWrap); 422return Utils.MarshalInvoke(WrapCore<int>, keyType.ItemType.RawType, env, mapper, trainSchema); 599Contracts.Assert(Utils.Size(mapperOutputs) == 1);
Scorers\PredictedLabelScorerBase.cs (1)
78_predColMetadata = Utils.MarshalInvoke(_keyValueMetadataFromMetadataMethodInfo, trainLabelColVecType.RawType,
Scorers\RowToRowScorerBase.cs (1)
211return Utils.MarshalInvoke(_getGetterFromRowMethodInfo, type.RawType, row, col);
Scorers\SchemaBindablePredictorWrapper.cs (9)
163return Utils.MarshalInvoke(_getValueGetterMethodInfo, this, typeSrc.RawType, ScoreType.RawType, input, colSrc); 330Contracts.Assert(Utils.Size(outputNames) == 1); // Score. 346Contracts.Assert(Utils.Size(outputNames) <= 2); // PredictedLabel and/or Score. 437Contracts.Assert(Utils.Size(outputNames) == 2); // Score and prob. 458Contracts.Assert(Utils.Size(outputNames) == 3); // Predicted Label, Score and Probability. 555Contracts.Assert(Utils.Size(active) == 2); 612var active = Utils.BuildArray(OutputSchema.Count, activeColumns); 671Contracts.CheckDecode(Utils.Size(_quantiles) > 0); 708Contracts.Assert(Utils.Size(_quantiles) > 0);
Training\TrainerUtils.cs (3)
147if (keyType.Count >= Utils.ArrayMaxSize) 176if (max >= Utils.ArrayMaxSize) 653Contracts.Assert(Utils.Size(inputs) > 0);
Transforms\ColumnBindingsBase.cs (5)
201if (string.IsNullOrWhiteSpace(Name) || Utils.Size(Source) == 0) 226if (string.IsNullOrWhiteSpace(Name) || Utils.Size(Source) == 0) 283var getter = Utils.MarshalInvoke(GetAnnotationGetterDelegate<int>, kvp.Value.RawType, inputBindings, i, kvp.Key); 590=> Utils.BuildArray(ColumnCount, predicate); 596=> Utils.BuildArray(ColumnCount, columns);
Transforms\ColumnConcatenatingTransformer.cs (6)
374env.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns)); 377env.CheckUserArg(Utils.Size(options.Columns[i].Source) > 0, nameof(options.Columns)); 394env.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns)); 397env.CheckUserArg(Utils.Size(options.Columns[i].Source) > 0, nameof(options.Columns)); 678return Utils.MarshalInvoke(_makeIdentityGetterMethodInfo, this, OutputType.RawType, input); 680return Utils.MarshalInvoke(_makeGetterMethodInfo, this, OutputType.ItemType.RawType, input);
Transforms\ColumnCopying.cs (1)
221return Utils.MarshalInvoke(_makeGetterMethodInfo, type.RawType, input, colIndex);
Transforms\ColumnSelecting.cs (4)
231bool keepValid = Utils.Size(keepColumns) > 0; 232bool dropValid = Utils.Size(dropColumns) > 0; 688var active = Utils.BuildArray(_mapper.OutputSchema.Count, columnsNeeded); 701var active = Utils.BuildArray(_mapper.OutputSchema.Count, columnsNeeded);
Transforms\FeatureContributionCalculationTransformer.cs (1)
210return Utils.MarshalInvoke(_getValueGetterMethodInfo, this, _featureColumnType.RawType, input, ColMapNewToOld[iinfo]);
Transforms\GenerateNumberTransform.cs (3)
109Contracts.Assert(Utils.Size(useCounter) == InfoCount); 110Contracts.Assert(Utils.Size(states) == InfoCount); 282Host.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns));
Transforms\Hashing.cs (19)
220Utils.Add(ref invertIinfos, i); 221Utils.Add(ref invertHashMaxCounts, invertHashMaxCount); 225if (Utils.Size(sourceColumnsForInvertHash) > 0) 602var hash = Hashing.MurmurRound(seed, Utils.GetLo(v)); 603var hi = Utils.GetHi(v); 740var hash = Hashing.MurmurRound(seed, Utils.GetLo(value)); 741var hi = Utils.GetHi(value); 834var hash = Hashing.MurmurRound(seed, Utils.GetLo(value)); 835var hi = Utils.GetHi(value); 868var hash = Hashing.MurmurRound(seed, Utils.GetLo(value.Low)); 869var hi = Utils.GetHi(value.Low); 874hash = Hashing.MurmurRound(hash, Utils.GetLo(value.High)); 875hi = Utils.GetHi(value.High); 989var hash = Hashing.MurmurRound(seed, Utils.GetLo((ulong)value)); 990var hi = Utils.GetHi((ulong)value); 1000Contracts.Assert(Utils.IsPowerOfTwo(mask + 1)); 1026Contracts.Assert(Utils.IsPowerOfTwo(mask + 1)); 1144Contracts.Assert(Utils.IsPowerOfTwo(mask + 1)); 1282Contracts.Assert(Utils.IsPowerOfTwo(mask + 1));
Transforms\InvertHashUtils.cs (6)
95if (Utils.Size(src) > 0) 97Utils.EnsureSize(ref buffer, src.Length); 192Contracts.Assert(Utils.Size(pairs) > 0); 196Utils.EnsureSize(ref buffer, count); 205return Utils.Size(temp) > 0 ? temp.ToString().AsMemory() : String.Empty.AsMemory(); 433Utils.EnsureSize(ref buffer, text.Length);
Transforms\LabelConvertTransform.cs (1)
86Contracts.Assert(Infos.Length == Utils.Size(args.Columns));
Transforms\LabelIndicatorTransform.cs (1)
138Host.Assert(Infos.Length == Utils.Size(options.Columns));
Transforms\MetadataDispatcher.cs (4)
363Contracts.CheckParam(Utils.Size(kindsSrc) >= 2, nameof(kindsSrc)); 417Utils.Add(ref _getters, new GetterInfoDelegate<TValue>(kind, type, getter)); 433Utils.Add(ref _getters, new GetterInfoPrimitive<TValue>(kind, type, value)); 453if (Utils.Size(getters) > 0)
Transforms\NAFilter.cs (2)
98Host.CheckUserArg(Utils.Size(args.Columns) > 0, nameof(args.Columns)); 289return Utils.MarshalInvoke(method, genericArgument, cursor, info);
Transforms\NormalizeColumnDbl.cs (6)
145Utils.Add(ref indicesShift, iv); 161scales = Utils.CreateArray<TFloat>(numFeatures, 1); 181Utils.Add(ref indicesShift, iv); 255Contracts.CheckDecode(Utils.Size(curUpperBounds) > 0); 680host.Assert(Utils.Size(nz) == 0 || offsets != null); 745host.Assert(Utils.Size(nz) == 0 || offsets != null);
Transforms\NormalizeColumnSng.cs (6)
145Utils.Add(ref indicesShift, iv); 161scales = Utils.CreateArray<TFloat>(numFeatures, 1); 181Utils.Add(ref indicesShift, iv); 255Contracts.CheckDecode(Utils.Size(curUpperBounds) > 0); 838host.Assert(Utils.Size(nz) == 0 || offsets != null); 902host.Assert(Utils.Size(nz) == 0 || offsets != null);
Transforms\RowShufflingTransformer.cs (4)
197Utils.Add(ref columnsToDrop, c); 199if (Utils.Size(columnsToDrop) == 0) 516_pipeIndices = Utils.GetIdentityPermutation(_poolRows - 1 + _bufferDepth * _blockSize); 680return Utils.MarshalInvoke(_createGetterDelegateMethodInfo, this, Schema[col].Type.RawType, col);
Transforms\SkipTakeFilter.cs (1)
216var activeColumns = Utils.BuildArray(OutputSchema.Count, columnsNeeded);
Transforms\SlotsDroppingTransformer.cs (6)
299Host.CheckDecode(Utils.Size(SlotsMin[i]) > 0); 502=> (type is KeyDataViewType keytype && 0 < keytype.Count && keytype.Count < Utils.ArrayMaxSize) 745return Utils.MarshalInvoke(_makeOneTrivialGetterMethodInfo, this, _srcTypes[iinfo].RawType); 766return Utils.MarshalInvoke(_makeVecTrivialGetterMethodInfo, this, vectorType.ItemType.RawType); 787return Utils.MarshalInvoke(_makeVecGetterMethodInfo, this, vectorType.ItemType.RawType, input, iinfo); 821return Utils.MarshalInvoke(_getSrcGetterMethodInfo, this, typeDst.RawType, row, iinfo);
Transforms\TransformBase.cs (5)
321Contracts.Assert(Utils.Size(infos) == InfoCount); 332host.CheckUserArg(Utils.Size(column) > 0, nameof(column)); 502Host.CheckUserArg(Utils.Size(column) > 0, nameof(column)); 516Host.CheckUserArg(Utils.Size(column) > 0, nameof(column)); 708return Utils.MarshalInvoke(_getSrcGetterMethodInfo, this, typeDst.RawType, row, iinfo);
Transforms\ValueMapping.cs (2)
901return Utils.MarshalInvoke(_getVectorMethodInfo, vectorType.ItemType.RawType, _mapping[key]); 903return Utils.MarshalInvoke(_getValueMethodInfo, ValueColumn.Type.RawType, _mapping[key]);
Transforms\ValueToKeyMappingTransformer.cs (6)
574Utils.Add(ref toTrain, colIndex); 579ch.Assert((Utils.Size(toTrain) == 0) == (trainsNeeded == 0)); 580ch.Assert(Utils.Size(toTrain) <= trainsNeeded); 625Utils.Swap(ref trainerInfo[t], ref trainerInfo[tmin]); 626Utils.Swap(ref trainer[t], ref trainer[tmin++]); 762return Utils.MarshalInvoke(_makeGetterMethodInfo, this, type.RawType, input, iinfo);
Transforms\ValueToKeyMappingTransformerImpl.cs (8)
57return Utils.MarshalInvoke(_createCoreMethodInfo, itemType.RawType, itemType, sorted); 124var perm = Utils.GetIdentityPermutation(_pool.Count); 297return Utils.MarshalInvoke(CreateVec<int>, bldr.ItemType.RawType, row, col, count, bldr); 298return Utils.MarshalInvoke(CreateOne<int>, bldr.ItemType.RawType, row, col, autoConvert, count, bldr); 536return Utils.MarshalInvoke(LoadCodecCore<int>, codec.Type.RawType, ctx, ectx, codec, count); 843return Utils.MarshalInvoke(CreateCore<int>, map.ItemType.RawType, host, schema, map, infos, textMetadata, iinfo); 1100TypedMap.ItemType.GetKeyCountAsInt32(_host) == 0 || !Utils.MarshalInvoke(_addMetadataCoreMethodInfo, this, srcMetaType.ItemType.RawType, srcMetaType.ItemType, builder)) 1181TypedMap.ItemType.GetKeyCountAsInt32(_host) == 0 || !Utils.MarshalInvoke(_writeTextTermsCoreMethodInfo, this, srcMetaType.ItemType.RawType, srcMetaType.ItemType, writer))
Utilities\ModelFileUtils.cs (1)
262saver.SaveData(entry.Stream, view, Utils.GetIdentityPermutation(view.Schema.Count));
Utilities\SlotDropper.cs (1)
107Utils.Swap(ref src, ref dst);
Utils\ApiUtils.cs (4)
75return Utils.MarshalInvoke(_generatePeekFieldMethodInfo, typeof(TOwn), typeof(TRow), fieldType, fieldInfo, assignmentOpCode); 80return Utils.MarshalInvoke(_generatePeekPropertyMethodInfo, typeof(TOwn), typeof(TRow), propertyType, propertyInfo, assignmentOpCodeProp); 143return Utils.MarshalInvoke(_generatePokeFieldMethodInfo, typeof(TOwn), typeof(TRow), fieldType, fieldInfo, assignmentOpCode); 148return Utils.MarshalInvoke(_generatePokePropertyMethodInfo, typeof(TOwn), typeof(TRow), propertyType, propertyInfo);
Utils\SequencePool.cs (26)
53_buckets = Utils.CreateArray<int>(_mask + 1, -1); 73Contracts.CheckDecode(Utils.Size(_start) > 0 && _start[0] == 0); 78if (Utils.Size(_bytes) < 40) 82int ibit = Utils.IbitHigh((uint)Math.Max(_idLim, 31)); 88_buckets = Utils.CreateArray<int>(_mask + 1, -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)); 138Contracts.Assert(0 <= _start[_idLim] && Math.Max(40, _start[_idLim]) <= Utils.Size(_bytes)); 155Contracts.Assert(0 <= min && min <= lim && lim <= Utils.Size(sequence)); 200Contracts.Check(0 <= min && min <= lim && lim <= Utils.Size(sequence)); 221Contracts.Check(0 <= min && min <= lim && lim <= Utils.Size(sequence)); 232Contracts.Assert(0 <= min && min <= lim && lim <= Utils.Size(sequence)); 237Contracts.Check(_start.Length != Utils.ArrayMaxSize, "Cannot allocate memory for the sequence pool"); 240int size = (newSize > Utils.ArrayMaxSize) ? Utils.ArrayMaxSize : (int)newSize; 247Contracts.Check(_next.Length != Utils.ArrayMaxSize, "Cannot allocate memory for the sequence pool"); 250int size = (newSize > Utils.ArrayMaxSize) ? Utils.ArrayMaxSize : (int)newSize; 259Contracts.Check(_bytes.Length != Utils.ArrayMaxSize, "Cannot allocate memory for the sequence pool"); 261int size = (newSize > Utils.ArrayMaxSize) ? Utils.ArrayMaxSize : (int)newSize; 286_buckets = Utils.CreateArray<int>(size, -1); 347Contracts.Assert(0 <= min && min <= lim && lim <= Utils.Size(bytes)); 353if (Utils.Size(sequence) <= count)
Microsoft.ML.Ensemble (35)
EnsembleUtils.cs (3)
29int card = Utils.GetCardinality(features); 49Contracts.Assert(Utils.Size(includedIndices) == src.Length); 50Contracts.Assert(cardinality == Utils.GetCardinality(includedIndices));
EntryPoints\CreateEnsemble.cs (5)
335dataSerialized = new byte[Utils.Size(entries)][]; 336dataZipEntryNames = new string[Utils.Size(entries)]; 337for (int i = 0; i < Utils.Size(entries); i++) 383ch.Check(dataSerialized.Length == Utils.Size(entries)); 389if (Utils.Size(buffer) < len)
FeatureSubsetModel.cs (1)
30if (features != null && (card = Utils.GetCardinality(features)) < features.Count)
OutputCombiners\BaseMultiAverager.cs (2)
28Host.Assert(weights == null || Utils.Size(weights) == Utils.Size(src));
OutputCombiners\BaseStacking.cs (2)
195Utils.EnsureSize(ref labels, count + 1); 196Utils.EnsureSize(ref features, count + 1);
OutputCombiners\Median.cs (2)
84_host.Assert(weights == null || Utils.Size(weights) == Utils.Size(src));
OutputCombiners\MultiMedian.cs (3)
75Host.Assert(weights == null || Utils.Size(weights) == Utils.Size(src)); 87if (Utils.Size(raw) < count)
OutputCombiners\MultiVoting.cs (3)
75Host.Assert(weights == null || Utils.Size(weights) == Utils.Size(src)); 77int count = Utils.Size(src);
OutputCombiners\Voting.cs (3)
79_host.Assert(weights == null || Utils.Size(weights) == Utils.Size(src)); 81int len = Utils.Size(src);
PipelineEnsemble.cs (1)
612return Utils.MarshalInvoke(CheckKeyLabelColumnCore<int>, mdType.ItemType.RawType, env, models, (KeyDataViewType)labelType, schema, labelCol.Index, mdType);
Selector\SubModelSelector\BaseDiverseSelector.cs (1)
53Utils.EnsureSize(ref preds, count + 1);
Trainer\EnsembleDistributionModelParameters.cs (1)
234if (Utils.ExtractLettersAndNumbers(m.Key).ToLower().Equals(weightedAverager.WeightageMetricName.ToLower()))
Trainer\EnsembleModelParametersBase.cs (2)
32Host.Check(Utils.Size(models) > 0, "Ensemble was created with no models."); 115int numMetrics = Utils.Size(model.Metrics);
Trainer\EnsembleTrainerBase.cs (6)
85ch.CheckUserArg(Utils.Size(predictorFactories) > 0, nameof(EnsembleTrainer.Arguments.BasePredictors), "This should have at-least one value"); 92if (Utils.Size(predictorFactories) > NumModels) 185int modelSize = Utils.Size(models); 186if (modelSize < Utils.Size(Trainers)) 187ch.Warning("{0} of {1} trainings failed.", Utils.Size(Trainers) - modelSize, Utils.Size(Trainers));
Microsoft.ML.EntryPoints (10)
CrossValidationMacro.cs (2)
382env.Assert(Utils.Size(perInst) == 1); 388if (Utils.Size(input.ConfusionMatrix) > 0)
FeatureCombiner.cs (6)
30if (Utils.Size(Features) > 0) 57if (Utils.Size(feats) == 0) 92if (Utils.Size(ktv) > 0) 147if (Utils.Size(cvt) > 0) 177Utils.Add(ref ktv, new KeyToVectorMappingEstimator.ColumnOptions(colName, col.Name)); 188Utils.Add(ref cvt, new TypeConvertingEstimator.ColumnOptions(colName, DataKind.Single, col.Name));
JsonUtils\ExecuteGraphCommand.cs (1)
244saver.SaveData(fs, idv, Utils.GetIdentityPermutation(idv.Schema.Count)
JsonUtils\JsonManifestUtils.cs (1)
107if (Utils.Size(componentInfo.Aliases) > 0)
Microsoft.ML.FastTree (112)
BinFile\BinFinder.cs (4)
197Contracts.Assert(0 <= numDistinct && numDistinct <= Utils.Size(distinctCounts)); 240Utils.EnsureSize(ref _distinctCountsBuffer, arraySize, arraySize, keepOld: false); 241Utils.EnsureSize(ref _distinctValues, arraySize, arraySize, keepOld: false); 242Utils.EnsureSize(ref _counts, arraySize, arraySize, keepOld: false);
Dataset\Dataset.cs (4)
266FeatureFlockBase[][] featureParts = Utils.BuildArray(numParts, i => new FeatureFlockBase[NumFlocks]); 509Contracts.Check(Utils.Size(MaxDcg) == 0 || Utils.Size(MaxDcg[0]) == QueryIds.Length, "Length of MaxDCG does not match number of queries"); 593int[] perm = Utils.GetRandomPermutation(rnd, NumQueries);
Dataset\FeatureFlock.cs (7)
112Contracts.Assert(active == null || (0 <= featureOffset && featureOffset <= Utils.Size(active) - Flock.Count)); 186Utils.EnsureSize(ref hist, len); 1168: base(Utils.Size(hotFeatureStarts) - 1, categorical) 1172Contracts.Assert(Utils.Size(hotFeatureStarts) == binUpperBounds.Length + 1); // One more than number of features. 1174Contracts.Assert(Utils.IsMonotonicallyIncreasing(hotFeatureStarts)); 1181Contracts.Assert(AllBinUpperBounds.All(x => Utils.Size(x) >= 1)); 1251Contracts.Assert(active == null || (0 <= featureOffset && featureOffset <= Utils.Size(active) - Flock.Count));
Dataset\SingletonFeatureFlock.cs (1)
130Contracts.Assert(active == null || (0 <= featureOffset && featureOffset <= Utils.Size(active) - Flock.Count));
FastTree.cs (21)
412var activeFeatures = Utils.CreateArray(TrainSet.NumFeatures, true); 943Host.Assert(Utils.Size(binUpperBounds) == NumFeatures); 1055int[] f2sf = Utils.CreateArray(lim - min, -1); 1130int[] f2sf = Utils.CreateArray(lim - min, -1); 1193ch.Assert(Utils.Size(binUpperBounds) > 0); 1385bool[] localConstructBinFeatures = Utils.CreateArray<bool>(NumFeatures, true); 1501Contracts.Assert(Utils.Size(bup) > 0); 1776if (numInstances > Utils.ArrayMaxSize) 1777throw Host.ExceptParam(nameof(data), "Input data had {0} rows, but can only accommodate {1}", numInstances, Utils.ArrayMaxSize); 1947ch.Assert(Utils.Size(features) > 1); 2079ch.Assert(Utils.Size(bup) > 0); 2117Contracts.Assert(Utils.Size(bup) > 0); 2231Contracts.Assert(Utils.Size(bup) > 0); 2239if (countBins > Utils.ArrayMaxSize - (bup.Length - 1)) 2247ch.Assert(0 < countBins && countBins <= Utils.ArrayMaxSize); 2540Contracts.Assert(Utils.IsIncreasing(0, editor.Indices, count, length)); 2554Contracts.Assert(Utils.Size(binUpperBounds) > 0); 2696Contracts.Assert(Utils.IsIncreasing(0, features, values.Length)); 2700Utils.EnsureSize(ref workArray, _featureIndices.Length, keepOld: false); 3041Host.Check(Utils.Size(outputNames) >= 1); 3107string scoreVarName = (Utils.Size(outputNames) >= 2) ? outputNames[1] : outputNames[0]; // Get Score from PredictedLabel and/or Score columns
FastTreeRanking.cs (1)
411if (Utils.Size(dataset.MaxDcg) == 0)
FastTreeTweedie.cs (1)
192return Utils.BuildArray(dlabels.Length, i => (float)dlabels[i]);
GamModelParameters.cs (7)
90Host.CheckParam(Utils.IsMonotonicallyIncreasing(binUpperBounds[i]), nameof(binUpperBounds), "Array must be monotonically increasing"); 99_shapeToInputMap = Utils.GetIdentityPermutation(NumberOfShapeFunctions); 138Host.CheckDecode(Utils.Size(_binEffects[i]) >= 1); 149_shapeToInputMap = Utils.CreateArray(NumberOfShapeFunctions, -1); 236Host.CheckParam(Utils.Size(bins) == NumberOfShapeFunctions, nameof(bins)); 822DocCounts = context._binDocsList[internalIndex].Select(Utils.Size); 856return Utils.BuildArray(context._pred.NumberOfShapeFunctions,
RandomForestRegression.cs (5)
65Contracts.Assert(Utils.IsMonotonicallyIncreasing(_data)); 554if (!(0 <= lab && lab < Utils.ArrayMaxSize)) 558"[0,{2}) when doing shuffled labels", lab, i, Utils.ArrayMaxSize); 561Contracts.Assert(1 <= lim && lim <= Utils.ArrayMaxSize); 571int[] map = Utils.GetRandomPermutation(_rgen, _labelLim);
SumupPerformanceCommand.cs (4)
245_host.Assert(Utils.IsIncreasing(0, data.DocIndices, count, _len)); 279AutoResetEvent[] events = Utils.BuildArray(_parallel, i => new AutoResetEvent(false)); 280AutoResetEvent[] mainEvents = Utils.BuildArray(_parallel, i => new AutoResetEvent(false)); 291Thread thread = threadPool[t] = Utils.RunOnForegroundThread((object io) =>
Training\DcgCalculator.cs (9)
58_oneTwoThree = Utils.GetIdentityPermutation(maxDocsPerQuery); 161if (Utils.Size(dataset.MaxDcg) < 3) 181Utils.InterlockedAdd(ref _result, DCG3(scores, labels, begin, end) / maxDCG3); 263if (Utils.Size(dataset.MaxDcg) < 1) 281if (Utils.Size(dataset.MaxDcg) < 3) 302if (Utils.Size(dataset.MaxDcg) < 1) 320Utils.InterlockedAdd(ref _result, DCG1(scores, labels, begin, end) / maxDCG1); 424Utils.InterlockedAdd(ref result[t], dcg / maxDcg[t][query]); 430Utils.InterlockedAdd(ref result[t], dcg / maxDcg[t][query]);
Training\Parallel\SingleTrainer.cs (1)
46return Utils.CreateArray<bool>(numFeatures, true);
Training\TreeLearners\LeastSquaresRegressionTreeLearner.cs (2)
899+ sizeof(FloatType) * Utils.Size(Weights) 900+ sizeof(int) * Utils.Size(FlockToBestFeature);
Training\WinLossCalculator.cs (10)
30_oneTwoThree = Utils.GetIdentityPermutation(maxDocsPerQuery); 117Utils.InterlockedAdd(ref result[0], surplus); 119Utils.InterlockedAdd(ref result[1], surplus); 121Utils.InterlockedAdd(ref result[2], surplus); 123Utils.InterlockedAdd(ref result[3], surplus); 125Utils.InterlockedAdd(ref result[4], surplus); 127Utils.InterlockedAdd(ref result[5], surplus); 129Utils.InterlockedAdd(ref result[6], maxsurplus); 130Utils.InterlockedAdd(ref result[7], maxsurpluspos); 131Utils.InterlockedAdd(ref result[8], count);
TreeEnsemble\InternalRegressionTree.cs (17)
179Contracts.CheckParam(numLeaves - 1 == Utils.Size(splitFeatures), nameof(splitFeatures), "Size error, should equal to numLeaves - 1."); 180Contracts.CheckParam(numLeaves - 1 == Utils.Size(splitGain), nameof(splitGain), "Size error, should equal to numLeaves - 1."); 181Contracts.CheckParam(numLeaves - 1 == Utils.Size(rawThresholds), nameof(rawThresholds), "Size error, should equal to numLeaves - 1."); 182Contracts.CheckParam(numLeaves - 1 == Utils.Size(lteChild), nameof(lteChild), "Size error, should equal to numLeaves - 1."); 183Contracts.CheckParam(numLeaves - 1 == Utils.Size(gtChild), nameof(gtChild), "Size error, should equal to numLeaves - 1."); 184Contracts.CheckParam(numLeaves - 1 == Utils.Size(defaultValueForMissing), nameof(defaultValueForMissing), "Size error, should equal to numLeaves - 1."); 185Contracts.CheckParam(numLeaves == Utils.Size(leafValues), nameof(leafValues), "Size error, should equal to numLeaves."); 186Contracts.CheckParam(numLeaves - 1 == Utils.Size(categoricalSplitFeatures), nameof(categoricalSplitFeatures), "Size error, should equal to numLeaves - 1."); 187Contracts.CheckParam(numLeaves - 1 == Utils.Size(categoricalSplit), nameof(categoricalSplit), "Size error, should equal to numLeaves - 1."); 197Contracts.CheckParam(Utils.Size(splitFeatures) > 0, nameof(splitFeatures), "Number of split features must be positive"); 199NumLeaves = Utils.Size(splitFeatures) + 1; 438int numMaxNodes = Utils.Size(LteChild); 496checker(Utils.Size(Thresholds) == 0 || Thresholds.Length == numMaxNodes, "bad threshold length"); 497checker(Utils.Size(RawThresholds) == 0 || RawThresholds.Length == NumLeaves - 1, "bad rawthreshold length"); 500checker(Utils.Size(_splitGain) == 0 || _splitGain.Length == numMaxNodes, "bad splitgain length"); 501checker(Utils.Size(_gainPValue) == 0 || _gainPValue.Length == numMaxNodes, "bad gainpvalue length"); 502checker(Utils.Size(_previousLeafValue) == 0 || _previousLeafValue.Length == numMaxNodes, "bad previous leaf value length");
TreeEnsembleFeaturizer.cs (4)
346_ectx.Assert(Utils.Size(_leafIds) == _numTrees); 347_ectx.Assert(Utils.Size(_pathIds) == _numTrees); 771int[] permutation = Utils.GetRandomPermutation(RandomUtils.Create(seed), type.GetCountAsInt32(env)); 811return Utils.MarshalInvoke(AppendFloatMapper<int>, labelType.RawType, env, ch, input, labelName, (KeyDataViewType)labelType,
Utils\ToByteArrayExtensions.cs (14)
257return checked(sizeof(int) + Utils.Size(a) * sizeof(byte)); 281return checked(sizeof(int) + Utils.Size(a) * sizeof(short)); 314return checked(sizeof(int) + Utils.Size(a) * sizeof(ushort)); 347return checked(sizeof(int) + Utils.Size(array) * sizeof(int)); 352int length = Utils.Size(a); 385return checked(sizeof(int) + Utils.Size(array) * sizeof(uint)); 418return checked(sizeof(int) + Utils.Size(array) * sizeof(long)); 451return checked(sizeof(int) + Utils.Size(array) * sizeof(ulong)); 484return checked(sizeof(int) + Utils.Size(array) * sizeof(float)); 517return checked(sizeof(int) + Utils.Size(array) * sizeof(double)); 550if (Utils.Size(array) == 0) 580for (int i = 0; i < Utils.Size(array); ++i) 589Utils.Size(a).ToByteArray(buffer, ref position); 590for (int i = 0; i < Utils.Size(a); ++i)
Microsoft.ML.KMeansClustering (12)
KMeansModelParameters.cs (2)
79Host.CheckParam(Utils.Size(centroids) >= k, nameof(centroids), "Not enough centroids for predictor initialization"); 283Utils.EnsureSize(ref centroids, _k, _k);
KMeansPlusPlusTrainer.cs (10)
418Utils.Swap(ref cursor.Features, ref candidate); 477if (baseMaxInstancesToAccelerate > Utils.ArrayMaxSize) 478baseMaxInstancesToAccelerate = Utils.ArrayMaxSize; 894Utils.Swap(ref roundSamples[i], ref clusters[clusterCount]); 1007Utils.Swap(ref centroids[i], ref outCentroids[i]); 1229Utils.Swap(ref centroids[i], ref Centroids[i]); 1648Utils.Swap(ref wRow.Point, ref point); 1678Utils.EnsureSize(ref dst, numSamples); 1682Utils.Swap(ref row.Point, ref dst[i]); 1723Utils.EnsureSize(ref buffer, numCursors, numCursors);
Microsoft.ML.LightGbm (11)
LightGbmTrainerBase.cs (11)
785if (labelList.Count == Utils.ArrayMaxSize) 786throw ch.Except($"Dataset row count exceeded the maximum count of {Utils.ArrayMaxSize}"); 975Utils.EnsureSize(ref sampleValuePerColumn[i], curNonZeroCnt + 1); 976Utils.EnsureSize(ref sampleIndicesPerColumn[i], curNonZeroCnt + 1); 1000Utils.EnsureSize(ref sampleValuePerColumn[colIdx], curNonZeroCnt + 1); 1001Utils.EnsureSize(ref sampleIndicesPerColumn[colIdx], curNonZeroCnt + 1); 1048if ((long)catMetaData.NumCol * batchRow > Utils.ArrayMaxSize) 1049throw ch.Except("Size of array exceeded the " + nameof(Utils.ArrayMaxSize)); 1100Utils.EnsureSize(ref indptr, curRowCount + 1); 1111Utils.EnsureSize(ref indptr, curRowCount + 1); 1120Utils.EnsureSize(ref indptr, curRowCount + 1);
Microsoft.ML.Maml (1)
HelpCommand.cs (1)
451Utils.CheckOptionalUserDirectory(_xmlFilename, nameof(args.XmlFilename));
Microsoft.ML.Mkl.Components (6)
ComputeLRTrainingStdThroughHal.cs (1)
48Utils.Swap(ref hessian, ref invHessian);
OlsLinearRegression.cs (3)
787Contracts.Assert(Utils.Size(standardErrors) == weights.Length + 1); 788Contracts.Assert(Utils.Size(tValues) == weights.Length + 1); 789Contracts.Assert(Utils.Size(pValues) == weights.Length + 1);
VectorWhitening.cs (2)
229if (valueCount * valueCount > Utils.ArrayMaxSize) 238ectx.CheckDecode(Utils.Size(model) == valueCount * valueCount, "Invalid model size.");
Microsoft.ML.OnnxConverter (1)
SaveOnnxCommand.cs (1)
99Utils.CheckOptionalUserDirectory(args.Onnx, nameof(args.Onnx));
Microsoft.ML.OnnxTransformer (4)
OnnxTransform.cs (4)
631return Utils.MarshalInvoke(MakeTensorGetter<int>, elemRawType, input, iinfo, srcNamedValueGetters, activeOutputColNames, outputCacher); 637return Utils.MarshalInvoke(MakeObjectGetter<int>, type, input, iinfo, srcNamedValueGetters, activeOutputColNames, outputCacher); 803return Utils.MarshalInvoke(CreateNamedOnnxValueGetterCore<int>, type, input, colIndex, onnxShape); 826return Utils.MarshalInvoke(CreateNamedOnnxValueGetterVecCore<int>, type, input, colIndex, onnxShape);
Microsoft.ML.Parquet (6)
ParquetLoader.cs (2)
460Utils.BuildSubsetMaps(Schema.Count, columnsNeeded, out _actives, out _colToActivesIndex); 642order = _rand == null ? Enumerable.Range(0, size) : Utils.GetRandomPermutation(_rand, size);
PartitionedFileLoader.cs (4)
397_active = Utils.BuildArray(Schema.Count, columnsNeeded); 590getters[i] = Utils.MarshalInvoke(_createSubGetterDelegateCoreMethodInfo, this, type.RawType, i); 595getters[i] = Utils.MarshalInvoke(_createGetterDelegateCoreMethodInfo, this, type.RawType, idx, type); 656return Utils.GetRandomPermutation(rand, _parent._files.Count);
Microsoft.ML.PCA (2)
PcaTrainer.cs (2)
302host.Assert(Utils.Size(y) == omega.Length); // Size of Y and Omega: dimension x oversampled rank 665Utils.EnsureSize(ref vectors, _eigenVectors.Length, _eigenVectors.Length);
Microsoft.ML.Predictor.Tests (11)
CmdLine\CmdLine.cs (1)
229if (Utils.Size(nest) > 0)
CmdLine\CmdLineReverseTest.cs (1)
87var classes = Utils.MarshalInvoke(findLoadableClassesMethodInfo, ml.ComponentCatalog, typeof(SignatureCalibrator));
TestGamPublicInterfaces.cs (3)
51Utils.AreEqual(binUpperBounds[i], gam.GetBinUpperBounds(i).ToArray()); 56Utils.AreEqual(binEffects[i], gam.GetBinEffects(i).ToArray()); 96Utils.AreEqual(array1[i], array2[i]);
TestIniModels.cs (2)
541using (StreamWriter iniWriter = Utils.OpenWriter(iniStream)) 583using (StreamWriter iniWriter = Utils.OpenWriter(iniStream))
TestParallelFasttreeInterface.cs (1)
75return Utils.CreateArray<bool>(numFeatures, true);
TestPredictors.cs (2)
682int predCount = Utils.Size(fastTrees); 846var predCount = Utils.Size(predictors);
TestTransposer.cs (1)
245saver.SaveData(mem, view, Utils.GetIdentityPermutation(view.Schema.Count));
Microsoft.ML.Recommender (11)
MatrixFactorizationPredictor.cs (10)
145_leftFactorMatrix = Utils.ReadSingleArray(ctx.Reader, checked(NumberOfRows * ApproximationRank)); 146_rightFactorMatrix = Utils.ReadSingleArray(ctx.Reader, checked(NumberOfColumns * ApproximationRank)); 184_host.Check(Utils.Size(_leftFactorMatrix) == NumberOfRows * ApproximationRank, "Unexpected matrix size of a factor matrix (matrix P in LIBMF paper)"); 185_host.Check(Utils.Size(_rightFactorMatrix) == NumberOfColumns * ApproximationRank, "Unexpected matrix size of a factor matrix (matrix Q in LIBMF paper)"); 186Utils.WriteSinglesNoCount(ctx.Writer, _leftFactorMatrix); 187Utils.WriteSinglesNoCount(ctx.Writer, _rightFactorMatrix); 344_env.Check(Utils.Size(matrixColumnList) == 1, msg); 349_env.Check(Utils.Size(matrixRowList) == 1, msg); 395_env.Assert(Utils.Size(active) == OutputSchema.Count); 413var activeArray = Utils.BuildArray(OutputSchema.Count, activeColumns);
RecommenderUtils.cs (1)
56int kindCount = Utils.Size(data.Schema.GetColumns(role));
Microsoft.ML.ResultProcessor (3)
ResultProcessor.cs (3)
389if (Utils.Size(lines) == 0) 435if (Utils.Size(chainArgs.Commands) == 0) 699if (!TryParseFileToLines(filename, out lines, null) || Utils.Size(lines) == 0)
Microsoft.ML.StandardTrainers (81)
FactorizationMachine\FactorizationMachineTrainer.cs (1)
431ch.Check(checked(totalFeatureCount * fieldCount * _latentDimAligned) <= Utils.ArrayMaxSize, "Latent dimension or the number of fields too large");
FactorizationMachine\FieldAwareFactorizationMachineModelParameters.cs (7)
82Host.Assert(Utils.Size(linearWeights) == featureCount); 84Host.Assert(Utils.Size(latentWeights) == checked(featureCount * fieldCount * LatentDimAligned)); 117Host.Assert(Utils.Size(linearWeights) == featureCount); 149Host.Check(checked(featureCount * fieldCount * LatentDimAligned) <= Utils.ArrayMaxSize, "Latent dimension too large"); 151Host.CheckDecode(Utils.Size(linearWeights) == featureCount); 153Host.CheckDecode(Utils.Size(latentWeights) == featureCount * fieldCount * latentDim); 205Host.Assert(Utils.Size(_linearWeights) == FeatureCount);
LdSvm\LdSvmTrainer.cs (16)
408Host.Assert(Utils.Size(tempW) == count); 409Host.Assert(Utils.Size(w) == count); 410Host.Assert(Utils.Size(theta) == half); 411Host.Assert(Utils.Size(thetaPrime) == count); 412Host.Assert(Utils.Size(biasW) == count); 413Host.Assert(Utils.Size(biasTheta) == half); 414Host.Assert(Utils.Size(biasThetaPrime) == count); 415Host.Assert(Utils.Size(tempThetaPrime) == count); 416Host.Assert(Utils.Size(tempTheta) == half); 417Host.Assert(Utils.Size(tempBiasW) == count); 418Host.Assert(Utils.Size(tempBiasTheta) == half); 419Host.Assert(Utils.Size(tempBiasThetaPrime) == count); 526_indices = Utils.GetIdentityPermutation((int)Length); 538Utils.Swap(ref _indices[k], ref _indices[randIdx]); 578_indices = Utils.GetIdentityPermutation((int)Length); 627Utils.Swap(ref _indices[k], ref _indices[randIdx]);
Optimizer\LineSearch.cs (1)
480vec = new VBuffer<float>(Utils.Size(values), values);
Optimizer\Optimizer.cs (2)
370Utils.Swap(ref _x, ref _newX); 371Utils.Swap(ref _grad, ref _newGrad);
Optimizer\SgdOptimizer.cs (2)
210Utils.Swap(ref avg, ref prev); 223Utils.Swap(ref x, ref prev);
Standard\LinearModelParameters.cs (4)
139Host.Check(Utils.Size(outputs) >= 1); 145string scoreVarName = (Utils.Size(outputs) >= 2) ? outputs[1] : outputs[0]; // Get Score from PredictedLabel and/or Score columns 195Host.CheckDecode(Utils.Size(weights) == 0 || weights.All(x => FloatUtils.IsFinite(x))); 200Weight = new VBuffer<float>(len, Utils.Size(weights), weights, indices);
Standard\LogisticRegression\LbfgsPredictorBase.cs (9)
443if (NumFeatures >= Utils.ArrayMaxSize / ClassCount) 446"The number of model parameters which is equal to ('# of features' + 1) * '# of classes' should be less than or equal to {0}.", Utils.ArrayMaxSize); 622Utils.EnsureSize(ref _features, index + 1); 623Utils.EnsureSize(ref _labels, index + 1); 626Utils.EnsureSize(ref _weights, index + 1); 629Utils.Swap(ref _features[index], ref cursor.Features); 807Contracts.Assert(Utils.Size(_ranges) == _numChunks + 1); 808Contracts.Assert(Utils.Size(_localLosses) == _numChunks); 809Contracts.Assert(Utils.Size(_localGradients) + 1 == _numChunks);
Standard\LogisticRegression\MulticlassLogisticRegression.cs (9)
247if (Utils.Size(scores) < _numClasses) 509Contracts.Check(Utils.Size(weights) == NumberOfClasses); 510Contracts.Check(Utils.Size(bias) == NumberOfClasses); 582Host.CheckDecode(Utils.IsMonotonicallyIncreasing(starts)); 591Host.CheckDecode(Utils.IsIncreasing(0, indices[i], NumberOfFeatures)); 601Weights[i] = new VBuffer<float>(NumberOfFeatures, Utils.Size(values), values, indices[i]); 1032Utils.EnsureSize(ref weights, NumberOfClasses, NumberOfClasses); 1073Host.CheckDecode(0 <= id && id < Utils.Size(ctx.Strings)); 1086Contracts.Assert(Utils.Size(_labelNames) == NumberOfClasses);
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (2)
169Utils.EnsureSize(ref labelHistogram, size); 170Utils.EnsureSize(ref featureHistogram, size);
Standard\MulticlassClassification\OneVersusAllTrainer.cs (2)
360Host.Assert(Utils.Size(impl.Predictors) > 0); 689Contracts.Check(Utils.Size(predictors) > 0);
Standard\MulticlassClassification\PairwiseCouplingTrainer.cs (2)
265Host.Assert(Utils.Size(predictors) > 0); 273Host.Assert(Utils.Size(predictors[i]) == i + 1);
Standard\SdcaBinary.cs (13)
506if (dualsLength <= Utils.ArrayMaxSize) 512Contracts.Assert(invariantsLength <= Utils.ArrayMaxSize); 530if (dualsLength <= Utils.ArrayMaxSize) 533Contracts.Assert(count <= Utils.ArrayMaxSize); 545Contracts.Assert(Utils.Size(invariants) > 0); 568Contracts.Assert((idToIdx == null && ((long)idLoMax + 1) * weightSetCount <= Utils.ArrayMaxSize) || (idToIdx != null && count * weightSetCount <= Utils.ArrayMaxSize)); 963Contracts.Assert(Utils.Size(metrics) == 6); 1062Contracts.Assert(length <= Utils.ArrayMaxSize); 1527Host.CheckParam(Utils.Size(weights) == 1, nameof(weights)); 1528Host.CheckParam(Utils.Size(bias) == 1, nameof(bias)); 1815Host.CheckParam(Utils.Size(weights) == 1, nameof(weights)); 1816Host.CheckParam(Utils.Size(bias) == 1, nameof(bias));
Standard\SdcaMulticlass.cs (8)
183int numClasses = Utils.Size(weights); 184Contracts.Assert(Utils.Size(biasReg) == numClasses); 185Contracts.Assert(Utils.Size(biasUnreg) == numClasses); 362Contracts.Assert(Utils.Size(weights) == numClasses); 363Contracts.Assert(Utils.Size(biasReg) == numClasses); 364Contracts.Assert(Utils.Size(biasUnreg) == numClasses); 365Contracts.Assert(Utils.Size(metrics) == 6); 474Contracts.Assert(0 < length && length <= Utils.ArrayMaxSize);
Standard\SdcaRegression.cs (2)
146Host.CheckParam(Utils.Size(weights) == 1, nameof(weights)); 147Host.CheckParam(Utils.Size(bias) == 1, nameof(bias));
Standard\Simple\SimpleTrainers.cs (1)
406Host.Check(Utils.Size(outputs) >= 3);
Microsoft.ML.Sweeper (9)
Algorithms\Grid.cs (2)
132_permutation = Utils.GetRandomPermutation(Host.Rand, _nGridPoints); 149_permutation = Utils.GetRandomPermutation(Host.Rand, _nGridPoints);
Algorithms\KdoSweeper.cs (2)
100_host.CheckUserArg(Utils.Size(options.SweptParameters) > 0, nameof(options.SweptParameters), "KDO sweeper needs at least one parameter to sweep over"); 159_host.Assert(Utils.Size(previousRuns) > 1);
Algorithms\SmacSweeper.cs (1)
82_host.CheckUserArg(Utils.Size(options.SweptParameters) > 0, nameof(options.SweptParameters), "SMAC sweeper needs at least one parameter to sweep over");
AsyncSweeper.cs (2)
120if (Utils.Size(paramSets) > 0) 221if (Utils.Size(paramSets) == 0)
ConfigRunner.cs (1)
115var args = Utils.BuildArray(RunNums.Count + 2,
SweepCommand.cs (1)
92if (Utils.Size(sweeps) == 0)
Microsoft.ML.TensorFlow (8)
TensorflowTransform.cs (3)
23using Utils = Microsoft.ML.Internal.Utilities.Utils; 225return Utils.MarshalInvoke(CreateTensorValueGetter<int>, type.RawType, input, isVector, colIndex, tfShape); 650return Utils.MarshalInvoke(MakeGetter<int>, type, input, iinfo, srcTensorGetters, activeOutputColNames, outputCache);
TensorflowUtils.cs (3)
19using Utils = Microsoft.ML.Internal.Utilities.Utils; 92if (!(Utils.Size(dimensions) == 1 && dimensions[0] <= 0) && 93(Utils.Size(dimensions) > 0 && dimensions.Skip(1).All(x => x > 0)))
TensorTypeExtensions.cs (2)
9using Utils = Microsoft.ML.Internal.Utilities.Utils; 54Utils.EnsureSize(ref array, (int)tensor.size, (int)tensor.size, false);
Microsoft.ML.TestFramework (7)
BaseTestBaseline.cs (1)
1002return Utils.OpenWriter(File.Open(path, append ? FileMode.Append : FileMode.OpenOrCreate), encoding, bufferSize, false);
DataPipe\TestDataPipeBase.cs (2)
749Fail("{0} id collisions among {1} items", idCollisions, Utils.Size(idsSeen) + idCollisions); 755if (!Utils.Add(ref idsSeen, id))
SubComponent.cs (1)
220if (Utils.Size(src._settings) == 0)
TestCommandBase.cs (3)
90if (Utils.Size(many) == 0) 208Contracts.Assert((argUsage == Usage.None) != (Utils.Size(names) >= 1)); 380Contracts.Assert(Utils.Size(toCompare) == 0 || toCompare.All(x => x != null));
Microsoft.ML.Tests (10)
ExpressionLanguageTests\ExpressionLanguageTests.cs (4)
169var perm = Utils.GetIdentityPermutation(types.Length); 175if (Utils.Size(errors) > 0) 182if (Utils.Size(errors) > 0) 192if (Utils.Size(errors) > 0)
Scenarios\Api\TestApi.cs (4)
68var data1 = Utils.CreateArray(10, new OneIChannelWithAttribute()); 81var data2 = Utils.CreateArray(10, new OneStringWithAttribute()); 102var data3 = Utils.CreateArray(10, new TwoIChannelsWithAttributes()); 128var idv4 = env.Data.LoadFromEnumerable(Utils.CreateArray(10, example4));
Transformers\HashTests.cs (2)
164var denseVec = new VBuffer<T>(vecLen, Utils.CreateArray(vecLen, val)); 195var sparseVec = new VBuffer<T>(10, 3, Utils.CreateArray(3, val), new[] { 0, 3, 7 });
Microsoft.ML.TimeSeries (55)
AdaptiveSingularSpectrumSequenceModeler.cs (24)
388_host.CheckDecode(Utils.Size(_alpha) == _windowSize - 1); 393_host.CheckDecode(Utils.Size(_state) == _windowSize - 1); 433_host.CheckDecode(Utils.Size(tempArray) == _rank * _windowSize); 459_host.Assert(Utils.Size(_alpha) == _windowSize - 1); 527Contracts.Assert(Utils.Size(singularVectors) >= tMat.WindowSize * rank); 528Contracts.Assert(Utils.Size(output) >= tMat.SeriesLength); 551Contracts.Assert(Utils.Size(singularVectors) >= tMat.WindowSize * rank); 554Contracts.Assert(Utils.Size(output) >= len); 597Contracts.Assert(Utils.Size(alpha) > 0); 598Contracts.Assert(Utils.Size(signal) > 2 * Utils.Size(alpha)); // To assure that the autoregression noise variance is unbiased. 599Contracts.Assert(Utils.Size(series) >= Utils.Size(signal) + startIndex); 601var signalLength = Utils.Size(signal); 602var windowSize = Utils.Size(alpha) + 1; 646Contracts.Assert(Utils.Size(series) >= tMat.SeriesLength); 647Contracts.Assert(Utils.Size(outputSignal) >= tMat.SeriesLength); 648Contracts.Assert(Utils.Size(singularVectors) >= tMat.WindowSize * tMat.WindowSize); 649Contracts.Assert(Utils.Size(singularValues) >= tMat.WindowSize); 741Contracts.Assert(Utils.Size(series) >= tMat.SeriesLength); 742Contracts.Assert(Utils.Size(singularVectors) >= tMat.WindowSize * tMat.WindowSize); 743Contracts.Assert(Utils.Size(singularValues) >= tMat.WindowSize); 839if (Utils.Size(_alpha) == 1) 1253_host.Assert(Utils.Size(dataArray) > 0);
EigenUtils.cs (1)
515Contracts.Check(Utils.Size(input) >= n2, "The input matrix must at least have " + n2 + " elements");
MovingAverageTransform.cs (3)
77throw Host.ExceptUserArg(nameof(args.Weights), string.Format("{0} weights are provided, but {1} are expected (or none)'", Utils.Size(_weights), args.WindowSize)); 93Host.CheckDecode(_weights == null || Utils.Size(_weights) == WindowSize + 1 - _lag); 111Host.Assert(_weights == null || Utils.Size(_weights) == WindowSize + 1 - _lag);
PolynomialUtils.cs (9)
44Contracts.Assert(Utils.Size(coefficients) > 1); 48if (Utils.Size(companionMatrix) < n2) 73Contracts.CheckParam(Utils.Size(coefficients) >= 1, nameof(coefficients), "There must be at least one input coefficient."); 81if (Utils.Size(roots) < n) 195Contracts.Assert(uIndex + uLen <= Utils.Size(Coefficients)); 198Contracts.Assert(vIndex + vLen <= Utils.Size(Coefficients)); 201Contracts.Assert(dstIndex + uLen + vLen <= Utils.Size(destination)); 281Contracts.CheckParam(Utils.Size(roots) > 0, nameof(roots), "There must be at least 1 input root."); 376if (Utils.Size(coefficients) < n)
SequentialTransformerBase.cs (2)
813var active = Utils.BuildArray(n, predicate); 936var activeArr = Utils.BuildArray(OutputSchema.Count, activeColumns);
TrajectoryMatrix.cs (16)
137_ectx.Check(Utils.Size(data) >= _seriesLength, "The length of the input series cannot be less than that of the original series."); 192_ectx.Assert(Utils.Size(cov) >= _windowSize * _windowSize); 266_ectx.Assert(Utils.Size(vector) >= _k + srcIndex); 267_ectx.Assert(Utils.Size(result) >= _windowSize + dstIndex); 296_ectx.Assert(Utils.Size(vector) >= _k + srcIndex); 297_ectx.Assert(Utils.Size(result) >= _windowSize + dstIndex); 370_ectx.Assert(Utils.Size(vector) >= _windowSize + srcIndex); 371_ectx.Assert(Utils.Size(result) >= _k + dstIndex); 400_ectx.Assert(Utils.Size(vector) >= _windowSize + srcIndex); 401_ectx.Assert(Utils.Size(result) >= _k + dstIndex); 501_ectx.Assert(Utils.Size(u) >= _windowSize + uIndex); 502_ectx.Assert(Utils.Size(v) >= _k + vIndex); 503_ectx.Assert(Utils.Size(result) >= len + dstIndex); 572_ectx.Assert(Utils.Size(u) >= _windowSize + uIndex); 573_ectx.Assert(Utils.Size(v) >= _k + vIndex); 574_ectx.Assert(Utils.Size(result) >= len + dstIndex);
Microsoft.ML.TorchSharp (9)
AutoFormerV2\ObjectDetectionTrainer.cs (3)
626Microsoft.ML.Internal.Utilities.Utils.MarshalActionInvoke(SaveLabelValues<int>, labelColType.ItemType.RawType, ctx); 701var labelGetter = Microsoft.ML.Internal.Utilities.Utils.MarshalInvoke(_decodeInitMethodInfo, vecType.ItemType.RawType, value); 756var getter = Microsoft.ML.Internal.Utilities.Utils.MarshalInvoke(_makeLabelAnnotationGetter, this, keyType.ItemType.RawType, _parent.LabelColumn);
NasBert\NasBertTrainer.cs (2)
521var getter = Microsoft.ML.Internal.Utilities.Utils.MarshalInvoke(_makeLabelAnnotationGetter, this, keyType.ItemType.RawType, Parent.LabelColumn); 543var getter = Microsoft.ML.Internal.Utilities.Utils.MarshalInvoke(_makeLabelAnnotationGetter, this, keyType.ItemType.RawType, Parent.LabelColumn);
NasBert\NerTrainer.cs (2)
282Microsoft.ML.Internal.Utilities.Utils.MarshalActionInvoke(SaveLabelValues<int>, labelColType.ItemType.RawType, ctx); 347var labelGetter = Microsoft.ML.Internal.Utilities.Utils.MarshalInvoke(_decodeInitMethodInfo, vecType.ItemType.RawType, value);
NasBert\TextClassificationTrainer.cs (2)
219Microsoft.ML.Internal.Utilities.Utils.MarshalActionInvoke(SaveLabelValues<int>, labelColType.ItemType.RawType, ctx); 284var labelGetter = Microsoft.ML.Internal.Utilities.Utils.MarshalInvoke(_decodeInitMethodInfo, vecType.ItemType.RawType, value);
Microsoft.ML.Transforms (168)
CountFeatureSelection.cs (5)
138_host.CheckUserArg(Utils.Size(columns) > 0, nameof(columns)); 233host.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns)); 245Contracts.Assert(Utils.Size(scores) == size); 247Contracts.Assert(Utils.Size(columnOptions) == size); 297env.CheckParam(Utils.Size(columns) > 0, nameof(columns));
CustomMappingFilter.cs (2)
46return GetRowCursorCore(input, Utils.BuildArray(Input.Schema.Count, inputCols)); 83var active = Utils.BuildArray(Input.Schema.Count, inputCols);
CustomMappingTransformer.cs (1)
161result[i] = Utils.MarshalInvoke(GetDstGetter<int>, dstRow.Schema[i].Type.RawType, dstRow, i, refresh);
Dracula\CMCountTable.cs (3)
50: base(Utils.Size(tables), priorCounts, 0, null) 54Contracts.Assert(Utils.Size(tables[0]) == depth); 58Contracts.Check(tables.All(x => Utils.Size(x) == Depth), "Depth must be the same for all labels");
Dracula\CountTable.cs (6)
97env.CheckDecode(Utils.Size(_priorFrequencies) == LabelCardinality); 105env.CheckDecode(Utils.Size(_garbageCounts) == 0); 108env.CheckDecode(Utils.Size(_garbageCounts) == LabelCardinality); 128Contracts.Assert(Utils.Size(_priorFrequencies) == LabelCardinality); 136Contracts.Assert(Utils.Size(_garbageCounts) == 0); 139Contracts.Assert(Utils.Size(_garbageCounts) == LabelCardinality);
Dracula\CountTableTransformer.cs (3)
447Host.Assert(Utils.Size(seeds) == featurizer.ColCount); 467env.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns)); 574ctx.Writer.Write(Utils.Size(_labelClassNames));
Dracula\CountTargetEncodingTransformer.cs (2)
170_host.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns), "Columns must be specified"); 280env.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns));
Dracula\Featurizer.cs (1)
127Contracts.Check(Utils.Size(classNames) == _labelBinCount, "incorrect class names");
Dracula\MultiCountTable.cs (2)
95_host.Check(Utils.Size(inputCols) == n, "Inconsistent number of columns"); 264_host.Check(Utils.Size(inputCols) == table.ColCount, "Inconsistent number of columns");
Expression\BuiltinFunctions.cs (1)
372Contracts.CheckParam(Utils.Size(values) > 0, nameof(values), "Expected values to have positive length");
Expression\CodeGen.cs (5)
213Utils.Add(ref _errors, new Error(node.Token, "Code generation error")); 218Utils.Add(ref _errors, new Error(node.Token, msg)); 223Utils.Add(ref _errors, new Error(node.Token, msg, args)); 1251if (Utils.Size(ps) > 0 && (type = ps[ps.Length - 1].ParameterType).IsArray) 1284Contracts.Assert(Utils.Size(ps) == node.Args.Items.Length);
Expression\Error.cs (1)
39if (Utils.Size(Args) > 0)
Expression\LambdaBinder.cs (6)
95get { return Utils.Size(_errors) > 0; } 100Utils.Add(ref _errors, new Error(node.Token, msg)); 105Utils.Add(ref _errors, new Error(node.Token, string.Format(msg, args))); 1312if (Utils.Size(meths) == 0) 1552_host.Assert(Utils.Size(candidates) >= 2); 1591Utils.Swap(ref dup1, ref dup2);
Expression\LambdaParser.cs (6)
32if (Utils.Size(lineMap) == 0) 157Contracts.Assert(Utils.Size(perm) == types.Length); 167Contracts.Assert(Utils.Size(perm) == types.Length); 196if (Utils.Size(_errors) > 0 && _errors[_errors.Count - 1].Token == err.Token) 725Utils.Add(ref commas, TokMove()); 727return new ListNode(tok, list.ToArray(), Utils.ToArray(commas));
Expression\Node.cs (2)
1054if (Utils.Size(ps) > 0 && ps[ps.Length - 1].ParameterType.IsArray) 1061Contracts.Assert(Utils.Size(ps) == argCount);
Expression\TokKind.cs (1)
174Contracts.Assert(carg == Utils.Size(args));
ExpressionTransformer.cs (9)
81_host.Check(columns.All(col => Utils.Size(col.InputColumnNames) > 0)); 82_host.CheckParam(columns.All(col => Utils.Size(col.InputColumnNames) <= 5), nameof(ColumnOptions.InputColumnNames), "maximum number of inputs exceeded"); 90perm = Utils.GetIdentityPermutation(inputTypes.Length); 103if (Utils.Size(errors) > 0) 109if (Utils.Size(errors) > 0) 261ectx.Assert(Utils.Size(inputTypes) == Utils.Size(inputColumnNames)); 279if (Utils.Size(errors) > 0) 323Utils.Size(options.Column[i].Source) == 0 ? new[] { options.Column[i].Name } : options.Column[i].Source,
GroupTransform.cs (3)
114Host.CheckUserArg(Utils.Size(options.GroupKeys) > 0, nameof(options.GroupKeys), "There must be at least one group key"); 431IsSameKey = Utils.MarshalInvoke(_makeSameCheckerMethodInfo, type.RawType, row, col); 522_active = Utils.BuildArray(binding.OutputSchema.Count, predicate);
HashJoiningTransform.cs (11)
137if (Utils.Size(SlotMap) <= 1) 202Host.Assert(Infos.Length == Utils.Size(args.Columns)); 262Host.CheckDecode(Utils.Size(slotMap[j]) > 0); // null array could be returned by the call above 317ctx.Writer.Write(Utils.Size(ex.SlotMap)); 340Host.Assert(Utils.Size(slotMap) >= 1); 375return new[] { Utils.GetIdentityPermutation(srcSlotCount) }; 398if (Utils.Size(ex.SlotMap) <= 1) 493return Utils.MarshalInvoke(mi, this, itemType.RawType, input, iinfo); 579Host.Assert(Utils.Size(_exes[iinfo].SlotMap) == 1); 649uint hash = Hashing.MurmurRound(seed, Utils.GetLo(v)); 650return Hashing.MurmurRound(hash, Utils.GetHi(v));
KeyToVectorMapping.cs (1)
177_bitsPerKey[i] = Utils.IbitHigh((uint)_infos[i].TypeSrc.GetItemType().GetKeyCount()) + 2;
LoadTransform.cs (2)
76bool complement = args.Complement || Utils.Size(args.Tags) == 0; 78for (int i = 0; i < Utils.Size(args.Tags); i++)
MissingValueDroppingTransformer.cs (3)
223return Utils.MarshalInvoke(_makeVecGetterMethodInfo, this, _srcTypes[iinfo].GetItemType().RawType, input, iinfo); 274Utils.Swap(ref src, ref dst); 318Utils.Swap(ref src, ref dst);
MissingValueHandlingTransformer.cs (1)
139h.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns));
MissingValueIndicatorTransform.cs (1)
80Host.Assert(Infos.Length == Utils.Size(args.Columns));
MissingValueIndicatorTransformer.cs (3)
227return Utils.MarshalInvoke(_getIsNADelegateMethodInfo, type.GetItemType().RawType, type); 250=> Utils.MarshalInvoke(_composeGetterOneMethodInfo, this, _infos[iinfo].InputType.RawType, input, iinfo); 272=> Utils.MarshalInvoke(_composeGetterVecMethodInfo, this, _infos[iinfo].InputType.GetItemType().RawType, input, iinfo);
MissingValueReplacing.cs (7)
160return Utils.MarshalInvoke(_testTypeMethodInfo, itemType.RawType, itemType); 314Utils.Add(ref columnsToImpute, iinfo); 324if (Utils.Size(columnsToImpute) == 0) 362slotIsDefault[slot] = Utils.MarshalInvoke(_computeDefaultSlotsMethodInfo, this, types[slot].GetItemType().RawType, types[slot], (Array)repValues[slot]); 395return Utils.MarshalInvoke(_getIsNADelegateMethodInfo, this, type.GetItemType().RawType, type); 637=> Utils.MarshalInvoke(_composeGetterOneMethodInfo, this, _infos[iinfo].TypeSrc.RawType, input, iinfo); 663=> Utils.MarshalInvoke(_composeGetterVecMethodInfo, this, _infos[iinfo].TypeSrc.GetItemType().RawType, input, iinfo);
MutualInformationFeatureSelection.cs (9)
135_host.CheckUserArg(Utils.Size(columns) > 0, nameof(columns)); 326Contracts.Assert(Utils.Size(scores) == size); 327Contracts.Assert(Utils.Size(cols) == size); 406(0 < keyCount && keyCount < Utils.ArrayMaxSize) || type is BooleanDataViewType || 554Contracts.Assert(labelKeyCount < Utils.ArrayMaxSize); 632Contracts.Assert(keyCount < Utils.ArrayMaxSize); 633var mapper = Utils.MarshalInvoke(_makeKeyMapperMethodInfo, itemType.RawType, itemType); 646Contracts.Assert(0 < keyCount && keyCount < Utils.ArrayMaxSize); 687if (Utils.Size(_contingencyTable[0]) < numFeatures)
OneHotEncoding.cs (1)
100h.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns));
OneHotHashEncoding.cs (1)
149h.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns));
OptionalColumnTransform.cs (8)
59Contracts.Assert(Utils.Size(columnTypes) == InfoCount); 60Contracts.Assert(Utils.Size(srcCols) == InfoCount); 279Host.CheckUserArg(Utils.Size(args.Columns) > 0, nameof(args.Columns)); 397getters[iinfo] = Utils.MarshalInvoke(_getSrcGetterMethodInfo, this, _bindings.ColumnTypes[iinfo].GetItemType().RawType, input, iinfo); 413return Utils.MarshalInvoke(_makeGetterVecMethodInfo, this, vectorType.ItemType.RawType, vectorType.Size); 414return Utils.MarshalInvoke(_makeGetterOneMethodInfo, this, columnType.RawType); 501return Utils.MarshalInvoke(_makeGetterVecMethodInfo, this, vectorType.ItemType.RawType, vectorType.Size); 502return Utils.MarshalInvoke(_makeGetterOneMethodInfo, this, columnType.RawType);
PermutationFeatureImportance.cs (2)
39topExamples = topExamples ?? Utils.ArrayMaxSize; 199Utils.Shuffle<float>(shuffleRand, featureValuesBuffer);
StatefulCustomMappingTransformer.cs (4)
132var active = Utils.BuildArray(_bindings.Schema.Count, needCol); 189getters[iinfo] = Utils.MarshalInvoke(GetDstGetter<int>, col.Type.RawType, dstRow, col.Name, refresh); 232var active = Utils.BuildArray(_bindings.Schema.Count, needCol); 308_getters[iinfo] = Utils.MarshalInvoke(_parent.GetDstGetter<int>, _parent._bindings.Schema[i].Type.RawType, dstRow, _parent._bindings.Schema[i].Name, refresh);
Text\NgramHashingTransformer.cs (4)
224if (Utils.Size(columnWithInvertHash) > 0) 553Host.Assert(0 <= lim && lim <= Utils.Size(ngram)); 554Host.Assert(Utils.Size(ngram) == ngramLength); 795Contracts.Assert(Utils.Size(srcNames) == srcIndices.Length);
Text\NgramTransform.cs (20)
71if (NgramLength != null || UseAllLengths != null || SkipLength != null || Utils.Size(MaxNumTerms) != 0) 181Contracts.Assert(Utils.Size(NonEmptyLevels) == NgramLength); 256helpers[iinfo] = new NgramBufferBuilder(ngramLength, skipLength, Utils.ArrayMaxSize, 288Utils.EnsureSize(ref invDocFreqs[iinfo], totalNgrams); 304for (int i = 0; i < Utils.Size(invDocFreqs[iinfo]); i++) 342env.Assert(lims.Count == Utils.Size(counts)); 349env.Assert(0 < lim && lim <= Utils.Size(ngram)); 350env.Assert(lim <= Utils.Size(counts)); 401for (int j = 0; j < Utils.Size(_invDocFreqs[i]); j++) 423var maxNumTerms = Utils.Size(item.MaxNumTerms) > 0 ? item.MaxNumTerms : options.MaxNumTerms; 661Host.Assert(0 < lim && lim <= Utils.Size(ngram)); 662Host.Assert(lim <= Utils.Size(_parent._transformInfos[iinfo].NonEmptyLevels)); 1051Contracts.CheckUserArg(Utils.Size(maximumNgramsCounts) == 0 || 1052Utils.Size(maximumNgramsCounts) == 1 && maximumNgramsCounts[0] > 0, nameof(maximumNgramsCounts)); 1053limits[ngramLength - 1] = Utils.Size(maximumNgramsCounts) == 0 ? Defaults.MaximumNgramsCount : maximumNgramsCounts[0]; 1057Contracts.CheckUserArg(Utils.Size(maximumNgramsCounts) <= ngramLength, nameof(maximumNgramsCounts)); 1058Contracts.CheckUserArg(Utils.Size(maximumNgramsCounts) == 0 || maximumNgramsCounts.All(i => i >= 0) && maximumNgramsCounts[maximumNgramsCounts.Length - 1] > 0, nameof(maximumNgramsCounts)); 1059var extend = Utils.Size(maximumNgramsCounts) == 0 ? Defaults.MaximumNgramsCount : maximumNgramsCounts[maximumNgramsCounts.Length - 1]; 1060limits = Utils.BuildArray(ngramLength, i => i < Utils.Size(maximumNgramsCounts) ? maximumNgramsCounts[i] : extend);
Text\SentimentAnalyzingTransform.cs (2)
63var file = Utils.FindExistentFileOrNull("pretrained.model", "Sentiment", assemblyForBasePath: typeof(SentimentAnalyzingTransformer)); 139if (Utils.Size(hiddenNames) == 0)
Text\StopWordsRemovingTransformer.cs (5)
153Contracts.Assert(maxValue < Utils.ArrayMaxSize); 321Contracts.Assert(0 <= (int)lang && (int)lang < Utils.Size(StopWords)); 501Contracts.Assert(0 <= langVal && langVal < Utils.Size(StopWords)); 737if (Utils.Size(Stopwords) > 0) 1044if (Utils.Size(options.Stopwords) > 0)
Text\TextCatalog.cs (1)
66outputColumnName, Utils.Size(inputColumnNames) == 0 ? new[] { outputColumnName } : inputColumnNames,
Text\WordBagTransform.cs (10)
90if (NgramLength != null || SkipLength != null || UseAllLengths != null || Utils.Size(MaxNumTerms) > 0 || 115h.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns), "Columns must be specified"); 145h.CheckUserArg(Utils.Size(column.Source) > 0, nameof(column.Source)); 394if (NgramLength != null || SkipLength != null || UseAllLengths != null || Utils.Size(MaxNumTerms) > 0 || 462h.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns), "Columns must be specified"); 499maximumNumberOfKeys: Utils.Size(column.MaxNumTerms) > 0 ? column.MaxNumTerms[0] : 500Utils.Size(options.MaxNumTerms) > 0 ? options.MaxNumTerms[0] : 554Contracts.Check(Utils.Size(cols[i].Source) == 1, "too many source columns"); 687env.CheckUserArg(Utils.Size(col.Source) > 0, nameof(col.Source)); 712env.CheckUserArg(Utils.Size(col.Source) > 0 &&
Text\WordHashBagProducingTransform.cs (4)
92h.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns), "Columns must be specified"); 328h.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns), "Columns must be specified"); 346h.CheckUserArg(Utils.Size(column.Source) > 0 && 386h.CheckUserArg(Utils.Size(cols) > 0, nameof(Options.Columns), "Must be specified");
Text\WordTokenizing.cs (1)
141Contracts.CheckDecode(Utils.Size(separators) > 0);
Text\WrappedTextTransformers.cs (2)
176_host.CheckUserArg(Utils.Size(inputColumnName) > 0, nameof(columns)); 360_host.CheckUserArg(Utils.Size(input) > 0, nameof(input));
UngroupTransform.cs (6)
113Host.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns), "There must be at least one pivot column"); 198return Utils.BuildArray<DataViewRowCursor>(inputCursors.Length, 282_pivotIndex = Utils.CreateArray(InputColumnCount, -1); 387var activeInput = Utils.BuildArray(_inputSchema.Count, predicate); 483_active = Utils.BuildArray(_ungroupBinding.InputColumnCount, predicate); 507var sizeGetter = Utils.MarshalInvoke(_makeSizeGetterMethodInfo, this, rawItemType, info.Index);
Microsoft.ML.Vision (4)
DnnRetrainTransform.cs (4)
21using Utils = Microsoft.ML.Internal.Utilities.Utils; 473return Utils.MarshalInvoke(CreateTensorValueGetter<int>, typeof(UInt32), input, isVector, colIndex, tfShape, true); 475return Utils.MarshalInvoke(CreateTensorValueGetter<int>, type.RawType, input, isVector, colIndex, tfShape, false); 866return Utils.MarshalInvoke(MakeGetter<int>, type, input, iinfo, srcTensorGetters, activeOutputColNames, outputCache);