3 writes to Size
Microsoft.ML.DataView (3)
VectorType.cs (3)
48Size = size; 67Size = ComputeSize(Dimensions); 85Size = ComputeSize(Dimensions);
263 references to Size
Microsoft.ML.Core (7)
Data\AnnotationUtils.cs (3)
294&& vectorType.Size == vectorSize 385if (!(schema[colIndex].Type is VectorDataViewType vecType && vecType.Size > 0)) 394int columnSlotsCount = vecType.Size;
Data\ColumnTypeExtensions.cs (4)
50public static int GetVectorSize(this DataViewType columnType) => (columnType as VectorDataViewType)?.Size ?? 0; 56public static int GetValueCount(this DataViewType columnType) => (columnType as VectorDataViewType)?.Size ?? 1; 92return vectorType.Size == otherVectorType.Size;
Microsoft.ML.Core.Tests (6)
UnitTests\CoreBaseTestClass.cs (1)
87int size = vecType.Size;
UnitTests\ScoreSchemaTest.cs (1)
67Assert.Equal(keyNames.Length, (scoreMetadata.Schema[0].Type as VectorDataViewType).Size);
UnitTests\TestEntryPoints.cs (2)
5407Assert.True(type is VectorDataViewType vecType && vecType.ItemType is TextDataViewType && vecType.Size == 10); 6576Assert.Equal(10, (schema[2].Type as VectorDataViewType)?.Size);
UnitTests\TestModelLoad.cs (2)
54Assert.Equal(9, (result.Schema[1].Type as VectorDataViewType)?.Size); 55Assert.Equal(18, (result.Schema[2].Type as VectorDataViewType)?.Size);
Microsoft.ML.Data (127)
Data\RowCursorUtils.cs (1)
270int size = typeSrc.Size;
Data\SchemaAnnotationsExtensions.cs (5)
17/// is of <see cref="TextDataViewType"/>, and further whose <see cref="VectorDataViewType.Size"/> matches 24&& vectorType.Size > 0 25&& column.HasSlotNames(vectorType.Size); 40/// is of <see cref="TextDataViewType"/>, and further whose <see cref="VectorDataViewType.Size"/> matches 61&& keyType.Count == (ulong)vectorType.Size
DataLoadSave\Binary\Codecs.cs (2)
842_size = codec._type.Size; 988Contracts.CheckDecode(codec._type.Size == _size);
DataLoadSave\Text\TextSaver.cs (7)
168&& typeNames.Size == type.Size && typeNames.ItemType is TextDataViewType) 171Contracts.Check(_slotNames.Length == typeNames.Size, "Unexpected slot names length"); 173_slotCount = type.Size; 423if (typeNames != null && typeNames.Size == vectorType.Size && typeNames.ItemType is TextDataViewType) 513range = new TextLoader.Range { Min = minValue, Max = minValue + vectorType.Size - 1, ForceVector = true };
DataLoadSave\Transpose\TransposeLoader.cs (2)
304Host.CheckDecode(vectorType.Size == _parent._header.RowCount); 799Ch.Assert(((ITransposeDataView)_parent).GetSlotType(col).Size == _parent._header.RowCount);
DataLoadSave\Transpose\TransposeSaver.cs (1)
116header.RowCount = slotType.Size;
DataView\Transposer.cs (3)
1098Contracts.Assert(type.Size > 0); 1100Contracts.Assert(Utils.IsIncreasing(0, lims, type.Size + 1)); 1101Contracts.Assert(lims[lims.Length - 1] == type.Size);
Evaluators\BinaryClassifierEvaluator.cs (1)
179vecType.Size > 0 && vecType.ItemType == TextDataViewType.Instance)
Evaluators\ClusteringEvaluator.cs (2)
140Host.Assert(scoreType != null && scoreType.Size > 0); 141int numClusters = scoreType.Size;
Evaluators\EvaluatorUtils.cs (17)
354if (slotNamesType != null && slotNamesType.Size == size && slotNamesType.ItemType is TextDataViewType) 843if (dv.Schema[i].HasSlotNames(vectorType.Size)) 862vectorSizes.Add(name, vectorType.Size); 957if (cachedSize != type.Size) 961if (dv.Schema[col].HasSlotNames(type.Size)) 1019if (vectorType.Size == 0) 1026metricCount += vectorType.Size; 1028if (slotNamesType != null && slotNamesType.Size == vectorType.Size && slotNamesType.ItemType is TextDataViewType) 1032var editor = VBufferEditor.Create(ref names, vectorType.Size); 1033for (int j = 0; j < vectorType.Size; j++) 1238keyValuesType.Size != typeKeyCount) 1284iMetric += vectorType.Size; 1298var vectorMetrics = new double[type.Size]; 1305vectorStdevMetrics = new double[type.Size]; 1309var names = new ReadOnlyMemory<char>[type.Size]; 1312var slotNames = new VBuffer<ReadOnlyMemory<char>>(type.Size, names);
Evaluators\MulticlassClassificationEvaluator.cs (2)
79if (scoreType == null || scoreType.Size < 2 || scoreType.ItemType != NumberDataViewType.Single) 861if (scoreType == null || scoreType.Size < 2 || scoreType.ItemType != NumberDataViewType.Single)
Evaluators\MultiOutputRegressionEvaluator.cs (9)
552labelType = new VectorDataViewType((PrimitiveDataViewType)t.ItemType, t.Size); 553var slotNamesType = new VectorDataViewType(TextDataViewType.Instance, t.Size); 555builder.AddSlotNames(t.Size, CreateSlotNamesGetter(schema, LabelIndex, labelType.Size, "True")); 561scoreType = new VectorDataViewType((PrimitiveDataViewType)t.ItemType, t.Size); 563builder.AddSlotNames(t.Size, CreateSlotNamesGetter(schema, ScoreIndex, scoreType.Size, "Predicted")); 712labelCount = type.Size; 714ch.Check(labelCount == type.Size, "All vector metrics should contain the same number of slots");
Evaluators\QuantileRegressionEvaluator.cs (7)
60if (t == null || t.Size == 0 || (t.ItemType != NumberDataViewType.Single && t.ItemType != NumberDataViewType.Double)) 72Host.Assert(scoreType != null && scoreType.Size > 0 && (scoreType.ItemType == NumberDataViewType.Single || scoreType.ItemType == NumberDataViewType.Double)); 75if (slotNamesType != null && slotNamesType.Size == scoreType.Size && slotNamesType.ItemType is TextDataViewType) 77return new Aggregator(Host, LossFunction, schema.Weight != null, scoreType.Size, in slotNames, stratName); 452if (scoreType == null || scoreType.Size == 0 || (scoreType.ItemType != NumberDataViewType.Single && scoreType.ItemType != NumberDataViewType.Double)) 520var index = _index ?? vectorType.Size / 2;
Scorers\BinaryClassifierScorer.cs (2)
102return labelNameType is VectorDataViewType vectorType && vectorType.Size == 2; 306return new KeyDataViewType(typeof(uint), labelNameBindableMapper.Type.Size);
Scorers\MulticlassClassificationScorer.cs (2)
441return labelNameType is VectorDataViewType vectorType && vectorType.Size == scoreType.GetVectorSize(); 481return labelNameType is VectorDataViewType vectorType && vectorType.Size == scoreType.GetVectorSize() && vectorType.ItemType == TextDataViewType.Instance;
Scorers\PredictedLabelScorerBase.cs (2)
69if (trainLabelColumn?.Type is VectorDataViewType trainLabelColVecType && (ulong)trainLabelColVecType.Size == predColKeyType.Count) 71Contracts.Assert(trainLabelColVecType.Size > 0);
Scorers\SchemaBindablePredictorWrapper.cs (3)
144int typeVectorSize = typeVectorType?.Size ?? 0; 145int typeInVectorSize = typeInVectorType?.Size ?? 0; 707typeSrc.Size == ValueMapper.InputType.GetVectorSize() || ValueMapper.InputType.GetVectorSize() == 0);
Training\TrainerUtils.cs (2)
57if (!(col.Type is VectorDataViewType vecType && vecType.Size > 0 && vecType.ItemType == NumberDataViewType.Single)) 76length = colType.Size;
Transforms\ColumnConcatenatingTransformer.cs (14)
474int currentValueCount = curVectorType?.Size ?? 1; 503|| (curVectorType != null && inputSchema[srcCol].HasSlotNames(curVectorType.Size))) 583metadata.AddSlotNames(_slotNamesType.Size, GetSlotNames); 621Contracts.Assert(OutputType.Size > 0); 624Contracts.Assert(_slotNamesType.Size == OutputType.Size); 627bldr.Reset(_slotNamesType.Size, dense: false); 652if (typeNames != null && typeNames.Size == vectorTypeSrc.Size && typeNames.ItemType is TextDataViewType) 668slot += vectorTypeSrc.Size; 670Contracts.Assert(slot == OutputType.Size); 716if (vectorType.Size != 0 && vectorType.Size != tmpBufs[i].Length) 719input.Schema[SrcIndices[i]].Name, vectorType.Size, tmpBufs[i].Length)
Transforms\FeatureContributionCalculationTransformer.cs (3)
187if (InputSchema[_featureColumnIndex].HasSlotNames(_featureColumnType.Size)) 190_slotNames = VBufferUtils.CreateEmpty<ReadOnlyMemory<char>>(_featureColumnType.Size); 200return new[] { new DataViewSchema.DetachedColumn(DefaultColumnNames.FeatureContributions, new VectorDataViewType(NumberDataViewType.Single, _featureColumnType.Size), builder.ToAnnotations()) };
Transforms\Hashing.cs (2)
168return new VectorDataViewType(itemType, vectorType.Size); 1351builder.AddKeyValues(_parent._kvTypes[i].Size, (PrimitiveDataViewType)_parent._kvTypes[i].ItemType, getter);
Transforms\InvertHashUtils.cs (1)
396ch.Assert(vectorType.Size == 0);
Transforms\KeyToVector.cs (15)
317typeNames.Size != srcType.GetItemType().GetKeyCountAsInt32(Host)) 328builder.AddSlotNames(slotNamesType.Size, getter); 372Host.Assert(typeSrc.Size > 1); 380if (typeSlotSrc != null && typeSlotSrc.Size == typeSrc.Size && typeSlotSrc.ItemType is TextDataViewType) 383Host.Check(namesSlotSrc.Length == typeSrc.Size); 386namesSlotSrc = VBufferUtils.CreateEmpty<ReadOnlyMemory<char>>(typeSrc.Size); 389int slotLim = _types[iinfo].Size; 390Host.Assert(slotLim == (long)typeSrc.Size * keyCount); 473Host.Assert(size == _types[iinfo].Size); 511Host.Assert(size == _types[iinfo].Size); 514int cv = srcVectorType.Size; 560int cv = srcVectorType.Size; 562Host.Assert(_types[iinfo].Size == size * cv); 677if (!(_parent._columns[iinfo].OutputCountVector || srcVectorType.Size == 1))
Transforms\NormalizeColumnDbl.cs (8)
732int cv = Math.Max(1, typeSrc.Size); 1058int cv = Math.Max(1, typeSrc.Size); 1261int cv = Math.Max(1, typeSrc.Size); 1605var cv = srcType.Size; 1750var cv = srcType.Size; 1759var cv = srcType.Size; 1924var cv = srcType.Size; 2157var vectorSize = srcType.Size;
Transforms\NormalizeColumnSng.cs (8)
889int cv = Math.Max(1, typeSrc.Size); 1218int cv = Math.Max(1, typeSrc.Size); 1422int cv = Math.Max(1, typeSrc.Size); 1768var cv = srcType.Size; 1913var cv = srcType.Size; 1922var cv = srcType.Size; 2087var cv = srcType.Size; 2319var vectorSize = srcType.Size;
Transforms\SlotsDroppingTransformer.cs (4)
491int valueCount = srcVectorType?.Size ?? 1; 544var hasSlotNames = input[_cols[iinfo]].HasSlotNames(vectorType.Size); 795if (typeDst is VectorDataViewType dstVector && dstVector.IsKnownSize && dstVector.Size == srcValueCount) 840var hasSlotNames = InputSchema[_cols[iinfo]].HasSlotNames(vectorType.Size);
Transforms\ValueToKeyMappingTransformerImpl.cs (2)
1099if (srcMetaType == null || srcMetaType.Size != TypedMap.ItemType.GetKeyCountAsInt32(_host) || 1180if (srcMetaType == null || srcMetaType.Size != TypedMap.ItemType.GetKeyCountAsInt32(_host) ||
Microsoft.ML.DataView (11)
VectorType.cs (11)
22/// As with <see cref="Size"/>, a zero value indicates that the vector type is considered to have 49Dimensions = ImmutableArray.Create(Size); 57/// non-negative values. Also, because <see cref="Size"/> is the product of <see cref="Dimensions"/>, the result of 75/// non-negative values. Also, because <see cref="Size"/> is the product of <see cref="Dimensions"/>, the result of 104/// Equivalent to <c><see cref="Size"/> &gt; 0</c>. 106public bool IsKnownSize => Size > 0; 129if (Size != tmp.Size) 148int hash = Hashing.CombineHash(ItemType.GetHashCode(), Size); 162if (Size > 0) 163sb.Append(", ").Append(Size);
Microsoft.ML.Ensemble (20)
Trainer\EnsembleDistributionModelParameters.cs (7)
93if (vmdInputType.Size > 0) 97else if (vmdInputType.Size != inputType.Size) 153if (_inputType.Size > 0) 154Host.Check(src.Length == _inputType.Size); 191if (_inputType.Size > 0) 192Host.Check(src.Length == _inputType.Size);
Trainer\EnsembleModelParameters.cs (5)
83if (vmInputType.Size > 0) 87else if (vmInputType.Size != inputType.Size) 145if (_inputType.Size > 0) 146Host.Check(src.Length == _inputType.Size);
Trainer\Multiclass\EnsembleMulticlassModelParameters.cs (8)
75if (vmInputType.Size > 0) 79else if (vmInputType.Size != inputType.Size) 83if (outputType == null || vmOutputType.Size > outputType.Size) 130if (_inputType.Size > 0) 131Host.Check(src.Length == _inputType.Size); 160&& outVectorType.Size > 0 && outVectorType.ItemType == NumberDataViewType.Single)
Microsoft.ML.EntryPoints (1)
FeatureCombiner.cs (1)
168if (!(col.Type is VectorDataViewType vectorType) || vectorType.Size > 0)
Microsoft.ML.FastTree (5)
GamModelParameters.cs (2)
621public int NumFeatures => _pred._inputType.Size; 842Contracts.Assert(0 <= index && index < context._pred._inputType.Size);
TreeEnsembleFeaturizer.cs (3)
139treeIdMetadataBuilder.Add(AnnotationUtils.Kinds.SlotNames, AnnotationUtils.GetNamesType(treeValueType.Size), 151leafIdMetadataBuilder.Add(AnnotationUtils.Kinds.SlotNames, AnnotationUtils.GetNamesType(leafIdType.Size), 164pathIdMetadataBuilder.Add(AnnotationUtils.Kinds.SlotNames, AnnotationUtils.GetNamesType(pathIdType.Size),
Microsoft.ML.ImageAnalytics (1)
ImagePixelExtractor.cs (1)
318int size = type.Size;
Microsoft.ML.IntegrationTests (6)
IntrospectiveTraining.cs (2)
207var numFeatures = (transformedData.Schema["Features"].Type as VectorDataViewType).Size; 244var numFeatures = (transformedData.Schema["Features"].Type as VectorDataViewType).Size;
SchemaDefinitionTests.cs (4)
53Assert.Equal((engine1.OutputSchema["Features"].Type as VectorDataViewType).Size, prediction.Features.Length); 56Assert.Equal((engine2.OutputSchema["Features"].Type as VectorDataViewType).Size, prediction.Features.Length); 76outputSchemaDefinition["Features"].ColumnType = new VectorDataViewType(NumberDataViewType.Single, (schema["Features"].Type as VectorDataViewType).Size * 2); 91Assert.Equal(168, (schema["Features"].Type as VectorDataViewType).Size);
Microsoft.ML.Mkl.Components (3)
OlsLinearRegression.cs (1)
178return TrainCore(ch, cursorFactory, typeFeat.Size);
SymSgdClassificationTrainer.cs (1)
213ch.Check(examplesToFeedTrain.Schema.Feature.Value.Type is VectorDataViewType vecType && vecType.Size > 0, "Training set has no features, aborting training.");
VectorWhitening.cs (1)
322int cslot = vectorType.Size;
Microsoft.ML.OnnxConverter (1)
SaveOnnxCommand.cs (1)
254keyType.Count == (ulong)vectorType.Size;
Microsoft.ML.PCA (1)
PcaTransformer.cs (1)
511if (!(type is VectorDataViewType vectorType && vectorType.Size > 1 && vectorType.ItemType.Equals(NumberDataViewType.Single)))
Microsoft.ML.Predictor.Tests (6)
TestTransposer.cs (6)
31Assert.NotEqual(0, vecType?.Size); 32T[] retval = new T[rc * (vecType?.Size ?? 1)]; 77Assert.Equal(DataViewUtils.ComputeRowCount(view), type.Size); 79Assert.True(type.Size > 0, $"{desc} expected to be known sized vector but is not"); 80int valueCount = (colType as VectorDataViewType)?.Size ?? 1; 82int rc = type.Size;
Microsoft.ML.Samples (3)
Dynamic\DataOperations\LoadFromEnumerable.cs (3)
43$"{featureColumn.IsKnownSize}.\nSize: {featureColumn.Size}"); 67$"{featureColumn.IsKnownSize}.\nSize: {featureColumn.Size}"); 87$"{featureColumn.IsKnownSize}.\nSize: {featureColumn.Size}");
Microsoft.ML.StandardTrainers (14)
FactorizationMachine\FactorizationMachineTrainer.cs (2)
427_host.Assert(vectorType.Size > 0); 429totalFeatureCount += vectorType.Size;
Standard\LogisticRegression\LbfgsPredictorBase.cs (1)
488int nFeatures = typeFeat.Size;
Standard\LogisticRegression\MulticlassLogisticRegression.cs (1)
183if (!(labelMetadataType is VectorDataViewType vecType && vecType.ItemType == TextDataViewType.Instance && vecType.Size == _numClasses))
Standard\MulticlassClassification\OneVersusAllTrainer.cs (4)
526else if (inputType.Size != mapperVectorType.Size) 528if (inputType.Size == 0) 530else if (mapperVectorType.Size != 0)
Standard\MulticlassClassification\PairwiseCouplingTrainer.cs (4)
336else if (inputType.Size != vectorType.Size) 471if (_inputType.Size > 0) 472Host.Check(src.Length == _inputType.Size);
Standard\SdcaBinary.cs (1)
124ch.Check(examplesToFeedTrain.Schema.Feature.Value.Type is VectorDataViewType vecType && vecType.Size > 0, "Training set has no features, aborting training.");
Standard\StochasticTrainerBase.cs (1)
88ch.Check(examplesToFeedTrain.Schema.Feature.Value.Type is VectorDataViewType vecType && vecType.Size > 0, "Training set has no features, aborting training.");
Microsoft.ML.TensorFlow (1)
TensorflowTransform.cs (1)
556if (type is VectorDataViewType vecType && vecType.Size == 0)
Microsoft.ML.TestFramework (1)
DataPipe\TestDataPipeBase.cs (1)
933int size = vectorType.Size;
Microsoft.ML.TestFrameworkCommon (4)
TestCommon.cs (4)
116ulong vsize = type1 is VectorDataViewType vectorType ? (ulong)vectorType.Size : 0; 223return vectorType.Size == otherVectorType.Size; 289private static int GetVectorSize(this DataViewType columnType) => (columnType as VectorDataViewType)?.Size ?? 0;
Microsoft.ML.Tests (10)
TrainerEstimators\TreeEnsembleFeaturizerTest.cs (3)
64Assert.Equal(10, treeValuesType.Size); 82Assert.Equal(50, treeLeafIdsType.Size); 105Assert.Equal(40, treePathIdsType.Size);
Transformers\ConcatTests.cs (6)
75Assert.True(t is VectorDataViewType vt1 && vt1.ItemType == NumberDataViewType.Single && vt1.Size == 1); 77Assert.True(t is VectorDataViewType vt2 && vt2.ItemType == NumberDataViewType.Single && vt2.Size == 2); 79Assert.True(t is VectorDataViewType vt3 && vt3.ItemType == NumberDataViewType.Single && vt3.Size == 5); 81Assert.True(t is VectorDataViewType vt4 && vt4.ItemType == NumberDataViewType.Single && vt4.Size == 0); 143Assert.True(t is VectorDataViewType vt2 && vt2.ItemType == NumberDataViewType.Single && vt2.Size == 2); 145Assert.True(t is VectorDataViewType vt3 && vt3.ItemType == NumberDataViewType.Single && vt3.Size == 5);
Transformers\TextFeaturizerTests.cs (1)
705Assert.Equal(10, (savedData.Schema[0].Type as VectorDataViewType)?.Size);
Microsoft.ML.Transforms (34)
CountFeatureSelection.cs (1)
410var size = type.Size;
HashJoiningTransform.cs (4)
337slotMap = CompileSlotMap(customSlotMap, vectorType.Size); 339slotMap = CreateDefaultSlotMap(join, vectorType.Size); 536int expectedSrcLength = srcType.Size; 586int expectedSrcLength = srcType.Size;
KeyToVectorMapping.cs (7)
230typeNames.Size != _infos[iinfo].TypeSrc.GetItemType().GetKeyCountAsInt32(Host)) 245builder.AddSlotNames(slotNamesType.Size, getter); 296if (typeSlotSrc != null && typeSlotSrc.Size == srcVectorSize && typeSlotSrc.ItemType is TextDataViewType) 304int slotLim = _types[iinfo].Size; 357Host.Assert(bitsPerKey == _types[iinfo].Size); 359int dstLength = _types[iinfo].Size; 387int cv = typeSrc.Size;
MissingValueIndicatorTransform.cs (9)
151typeNames.Size != vectorType.Size || 162AnnotationUtils.GetNamesType(types[iinfo].Size), GetSlotNames); 179int size = _types[iinfo].Size; 188Host.Assert(_types[iinfo].Size == 2); 196Host.Assert(size == 2 * srcVectorType.Size); 200if (typeNames == null || typeNames.Size != srcVectorType.Size || !(typeNames.ItemType is TextDataViewType)) 209Host.Check(names.Length == srcVectorType.Size, "Unexpected slot name vector size");
MissingValueReplacing.cs (4)
256Host.Assert(srcType.Size == src.Length); 259_repIsDefault[iinfo] = new BitArray(srcType.Size); 584if (vectorType.Size != repVectorType.Size)
MissingValueReplacingUtils.cs (3)
49if (vectorType.Size == 0) 239Stat = new TStatItem[type.Size]; 346_valuesProcessed = new long[type.Size];
OptionalColumnTransform.cs (2)
413return Utils.MarshalInvoke(_makeGetterVecMethodInfo, this, vectorType.ItemType.RawType, vectorType.Size); 501return Utils.MarshalInvoke(_makeGetterVecMethodInfo, this, vectorType.ItemType.RawType, vectorType.Size);
Text\LdaTransform.cs (1)
850if (inputSchema[srcCol].HasSlotNames(srcColType.Size))
Text\NgramHashingTransformer.cs (1)
570_types[iinfo].Size, ngramIdFinder);
Text\TextNormalizing.cs (1)
337Host.Assert(vectorType.Size >= 0);
UngroupTransform.cs (1)
339infos[i] = new PivotColumnOptions(name, col, colType.Size, colType.ItemType);
Microsoft.ML.Vision (1)
DnnRetrainTransform.cs (1)
780if (type is VectorDataViewType vecType && vecType.Size == 0)