From b3a3c665aa3d986ffd06a221f07b46f589e45c75 Mon Sep 17 00:00:00 2001 From: feiyun0112 Date: Fri, 18 Jun 2021 02:13:13 +0800 Subject: [PATCH] Remove empty statement (#5827) * Remove empty statement * Remove empty statement --- .../Scorers/SchemaBindablePredictorWrapper.cs | 2 +- src/Microsoft.ML.Data/Transforms/ColumnSelecting.cs | 2 +- src/Microsoft.ML.Data/Transforms/Hashing.cs | 2 +- src/Microsoft.ML.Data/Transforms/KeyToVector.cs | 2 +- src/Microsoft.ML.Data/Transforms/TypeConverting.cs | 2 +- .../Transforms/ValueToKeyMappingTransformer.cs | 2 +- src/Microsoft.ML.EntryPoints/PermutationFeatureImportance.cs | 4 ++-- src/Microsoft.ML.FastTree/Utils/LinqExtensions.cs | 2 +- src/Microsoft.ML.Featurizers/TimeSeriesImputerDataView.cs | 2 +- src/Microsoft.ML.LightGbm/LightGbmTrainerBase.cs | 2 +- src/Microsoft.ML.LightGbm/WrappedLightGbmDataset.cs | 4 ++-- src/Microsoft.ML.OnnxTransformer/OnnxUtils.cs | 2 +- src/Microsoft.ML.Parquet/PartitionedPathParser.cs | 2 +- src/Microsoft.ML.StandardTrainers/Standard/SdcaBinary.cs | 2 +- src/Microsoft.ML.Transforms/KeyToVectorMapping.cs | 2 +- src/Microsoft.ML.Transforms/MissingValueReplacing.cs | 2 +- src/Microsoft.ML.Transforms/RandomFourierFeaturizing.cs | 2 +- src/Microsoft.ML.Transforms/Text/NgramHashingTransformer.cs | 2 +- src/Microsoft.ML.Transforms/Text/NgramTransform.cs | 2 +- src/Microsoft.ML.Transforms/Text/TokenizingByCharacters.cs | 2 +- 20 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Microsoft.ML.Data/Scorers/SchemaBindablePredictorWrapper.cs b/src/Microsoft.ML.Data/Scorers/SchemaBindablePredictorWrapper.cs index c114085bc8..e18bd087ee 100644 --- a/src/Microsoft.ML.Data/Scorers/SchemaBindablePredictorWrapper.cs +++ b/src/Microsoft.ML.Data/Scorers/SchemaBindablePredictorWrapper.cs @@ -222,7 +222,7 @@ public SingleValueRowMapper(RoleMappedSchema schema, SchemaBindablePredictorWrap if (!InputRoleMappedSchema.Feature.HasValue || dependingColumns.Count() == 0) return Enumerable.Empty(); - return Enumerable.Repeat(InputRoleMappedSchema.Feature.Value, 1); ; + return Enumerable.Repeat(InputRoleMappedSchema.Feature.Value, 1); } public IEnumerable> GetInputColumnRoles() diff --git a/src/Microsoft.ML.Data/Transforms/ColumnSelecting.cs b/src/Microsoft.ML.Data/Transforms/ColumnSelecting.cs index 359fad24b1..fbcde6585e 100644 --- a/src/Microsoft.ML.Data/Transforms/ColumnSelecting.cs +++ b/src/Microsoft.ML.Data/Transforms/ColumnSelecting.cs @@ -320,7 +320,7 @@ private static bool GetHiddenOption(IHostEnvironment env, HiddenColumnOption opt return false; default: throw env.Except("Unsupported hide option specified"); - }; + } } /// diff --git a/src/Microsoft.ML.Data/Transforms/Hashing.cs b/src/Microsoft.ML.Data/Transforms/Hashing.cs index 58c396be5b..027a7a0854 100644 --- a/src/Microsoft.ML.Data/Transforms/Hashing.cs +++ b/src/Microsoft.ML.Data/Transforms/Hashing.cs @@ -342,7 +342,7 @@ private static IDataTransform Create(IHostEnvironment env, Options options, IDat item.Seed ?? options.Seed, item.Ordered ?? options.Ordered, item.MaximumNumberOfInverts ?? options.MaximumNumberOfInverts); - }; + } return new HashingTransformer(env, input, cols).MakeDataTransform(input); } diff --git a/src/Microsoft.ML.Data/Transforms/KeyToVector.cs b/src/Microsoft.ML.Data/Transforms/KeyToVector.cs index fdd97048ab..38b5355393 100644 --- a/src/Microsoft.ML.Data/Transforms/KeyToVector.cs +++ b/src/Microsoft.ML.Data/Transforms/KeyToVector.cs @@ -206,7 +206,7 @@ private static IDataTransform Create(IHostEnvironment env, Options options, IDat item.Name, item.Source ?? item.Name, item.Bag ?? options.Bag); - }; + } return new KeyToVectorMappingTransformer(env, cols).MakeDataTransform(input); } diff --git a/src/Microsoft.ML.Data/Transforms/TypeConverting.cs b/src/Microsoft.ML.Data/Transforms/TypeConverting.cs index 4af5ea8344..4ca7603a67 100644 --- a/src/Microsoft.ML.Data/Transforms/TypeConverting.cs +++ b/src/Microsoft.ML.Data/Transforms/TypeConverting.cs @@ -336,7 +336,7 @@ internal static IDataTransform Create(IHostEnvironment env, Options options, IDa kind = tempResultType.Value; } cols[i] = new TypeConvertingEstimator.ColumnOptions(item.Name, kind.ToDataKind(), item.Source ?? item.Name, keyCount); - }; + } return new TypeConvertingTransformer(env, cols).MakeDataTransform(input); } diff --git a/src/Microsoft.ML.Data/Transforms/ValueToKeyMappingTransformer.cs b/src/Microsoft.ML.Data/Transforms/ValueToKeyMappingTransformer.cs index 7947ddaaf4..39cd8ff817 100644 --- a/src/Microsoft.ML.Data/Transforms/ValueToKeyMappingTransformer.cs +++ b/src/Microsoft.ML.Data/Transforms/ValueToKeyMappingTransformer.cs @@ -298,7 +298,7 @@ internal static IDataTransform Create(IHostEnvironment env, Options options, IDa item.TextKeyValues ?? options.TextKeyValues); cols[i].Keys = item.Terms; cols[i].Key = item.Term ?? options.Term; - }; + } var keyData = GetKeyDataViewOrNull(env, ch, options.DataFile, options.TermsColumn, options.Loader, out bool autoLoaded); return new ValueToKeyMappingTransformer(env, input, cols, keyData, autoLoaded).MakeDataTransform(input); } diff --git a/src/Microsoft.ML.EntryPoints/PermutationFeatureImportance.cs b/src/Microsoft.ML.EntryPoints/PermutationFeatureImportance.cs index fc620beeb4..508882ee1a 100644 --- a/src/Microsoft.ML.EntryPoints/PermutationFeatureImportance.cs +++ b/src/Microsoft.ML.EntryPoints/PermutationFeatureImportance.cs @@ -183,7 +183,7 @@ private static IDataView GetMulticlassMetrics( TopKAccuracyStdErr = pMetric.TopKAccuracy.StandardError, PerClassLogLoss = pMetric.PerClassLogLoss.Select(x => x.Mean).ToArray(), PerClassLogLossStdErr = pMetric.PerClassLogLoss.Select(x => x.StandardError).ToArray() - }); ; + }); } // Convert unknown size vectors to known size. @@ -314,7 +314,7 @@ private static string[] GetSlotNames(RoleMappedSchema schema) foreach (var value in slotValues) { slotNames.Add(value.ToString()); - }; + } return slotNames.ToArray(); } diff --git a/src/Microsoft.ML.FastTree/Utils/LinqExtensions.cs b/src/Microsoft.ML.FastTree/Utils/LinqExtensions.cs index 7d4451e487..ee0724099b 100644 --- a/src/Microsoft.ML.FastTree/Utils/LinqExtensions.cs +++ b/src/Microsoft.ML.FastTree/Utils/LinqExtensions.cs @@ -206,7 +206,7 @@ public static T[] ToArray(this IEnumerable me, int length) public static IEnumerable CumulativeSum(this IEnumerable s) { int sum = 0; - ; + foreach (var x in s) { sum = sum + x; diff --git a/src/Microsoft.ML.Featurizers/TimeSeriesImputerDataView.cs b/src/Microsoft.ML.Featurizers/TimeSeriesImputerDataView.cs index f5bc2d7db0..df31cb7493 100644 --- a/src/Microsoft.ML.Featurizers/TimeSeriesImputerDataView.cs +++ b/src/Microsoft.ML.Featurizers/TimeSeriesImputerDataView.cs @@ -749,7 +749,7 @@ public Cursor(IChannelProvider provider, DataViewRowCursor input, TransformerEst var sharedState = new SharedColumnState(); - _allColumns = _schema.Select(x => TypedColumn.CreateTypedColumn(x, dataColumns, allImputedColumnNames, sharedState)).ToDictionary(x => x.Column.Name); ; + _allColumns = _schema.Select(x => TypedColumn.CreateTypedColumn(x, dataColumns, allImputedColumnNames, sharedState)).ToDictionary(x => x.Column.Name); _allColumns[IsRowImputedColumnName] = new BoolTypedColumn(_schema[IsRowImputedColumnName], false, true, sharedState); foreach (var column in _allColumns.Values) diff --git a/src/Microsoft.ML.LightGbm/LightGbmTrainerBase.cs b/src/Microsoft.ML.LightGbm/LightGbmTrainerBase.cs index 78056c4e47..e616d12267 100644 --- a/src/Microsoft.ML.LightGbm/LightGbmTrainerBase.cs +++ b/src/Microsoft.ML.LightGbm/LightGbmTrainerBase.cs @@ -851,7 +851,7 @@ private void CreateDatasetFromSamplingData(IChannel ch, FloatLabelCursor.Factory nonZeroCntPerColumn[i] = 0; sampleValuePerColumn[i] = new double[estimateNonZeroCnt]; sampleIndicesPerColumn[i] = new int[estimateNonZeroCnt]; - }; + } using (var cursor = factory.Create()) { int step = 1; diff --git a/src/Microsoft.ML.LightGbm/WrappedLightGbmDataset.cs b/src/Microsoft.ML.LightGbm/WrappedLightGbmDataset.cs index 5003bf2ea6..4f9ae19f3d 100644 --- a/src/Microsoft.ML.LightGbm/WrappedLightGbmDataset.cs +++ b/src/Microsoft.ML.LightGbm/WrappedLightGbmDataset.cs @@ -61,7 +61,7 @@ public unsafe Dataset(double[][] sampleValuePerColumn, ptrArrayValues[i] = (double*)gcValues[i].AddrOfPinnedObject().ToPointer(); gcIndices[i] = GCHandle.Alloc(sampleIndicesPerColumn[i], GCHandleType.Pinned); ptrArrayIndices[i] = (int*)gcIndices[i].AddrOfPinnedObject().ToPointer(); - }; + } fixed (double** ptrValues = ptrArrayValues) fixed (int** ptrIndices = ptrArrayIndices) { @@ -79,7 +79,7 @@ public unsafe Dataset(double[][] sampleValuePerColumn, gcValues[i].Free(); if (gcIndices[i].IsAllocated) gcIndices[i].Free(); - }; + } } // Before adding examples (i.e., feature vectors of the original data set), the original labels, weights, and groups are added. SetLabel(labels); diff --git a/src/Microsoft.ML.OnnxTransformer/OnnxUtils.cs b/src/Microsoft.ML.OnnxTransformer/OnnxUtils.cs index 615b95fa04..c41ac0ceeb 100644 --- a/src/Microsoft.ML.OnnxTransformer/OnnxUtils.cs +++ b/src/Microsoft.ML.OnnxTransformer/OnnxUtils.cs @@ -315,7 +315,7 @@ private static bool CheckOnnxShapeCompatibility(IEnumerable left, IEnumerab // Along a specific axis, if any of left or right have unknown dimension, the overwriting can happen. if (l != r && l > 0 && r > 0) return false; - }; + } return true; } diff --git a/src/Microsoft.ML.Parquet/PartitionedPathParser.cs b/src/Microsoft.ML.Parquet/PartitionedPathParser.cs index 44abd08f07..96ec39a48d 100644 --- a/src/Microsoft.ML.Parquet/PartitionedPathParser.cs +++ b/src/Microsoft.ML.Parquet/PartitionedPathParser.cs @@ -278,7 +278,7 @@ void ICanSaveModel.Save(ModelSaveContext ctx) sb.Clear(); _host.Check(col.TryUnparse(sb)); ctx.SaveString(sb.ToString()); - }; + } } public IEnumerable ParseColumns(string path) { diff --git a/src/Microsoft.ML.StandardTrainers/Standard/SdcaBinary.cs b/src/Microsoft.ML.StandardTrainers/Standard/SdcaBinary.cs index d3695c870e..260fc51b83 100644 --- a/src/Microsoft.ML.StandardTrainers/Standard/SdcaBinary.cs +++ b/src/Microsoft.ML.StandardTrainers/Standard/SdcaBinary.cs @@ -1796,7 +1796,7 @@ private protected override SchemaShape.Column[] ComputeSdcaBinaryClassifierSchem NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation(true)))); - }; + } return outCols.ToArray(); } diff --git a/src/Microsoft.ML.Transforms/KeyToVectorMapping.cs b/src/Microsoft.ML.Transforms/KeyToVectorMapping.cs index 64e07d3a2f..57215b660b 100644 --- a/src/Microsoft.ML.Transforms/KeyToVectorMapping.cs +++ b/src/Microsoft.ML.Transforms/KeyToVectorMapping.cs @@ -128,7 +128,7 @@ private static IDataTransform Create(IHostEnvironment env, Options options, IDat { var item = options.Columns[i]; cols[i] = (item.Name, item.Source ?? item.Name); - }; + } } return new KeyToBinaryVectorMappingTransformer(env, cols).MakeDataTransform(input); } diff --git a/src/Microsoft.ML.Transforms/MissingValueReplacing.cs b/src/Microsoft.ML.Transforms/MissingValueReplacing.cs index 3422c420df..6407992274 100644 --- a/src/Microsoft.ML.Transforms/MissingValueReplacing.cs +++ b/src/Microsoft.ML.Transforms/MissingValueReplacing.cs @@ -447,7 +447,7 @@ internal static IDataTransform Create(IHostEnvironment env, Options options, IDa (MissingValueReplacingEstimator.ReplacementMode)(item.Kind ?? options.ReplacementKind), item.Slot ?? options.ImputeBySlot, item.ReplacementString); - }; + } return new MissingValueReplacingTransformer(env, input, cols).MakeDataTransform(input); } diff --git a/src/Microsoft.ML.Transforms/RandomFourierFeaturizing.cs b/src/Microsoft.ML.Transforms/RandomFourierFeaturizing.cs index dad5507a61..efc1035f17 100644 --- a/src/Microsoft.ML.Transforms/RandomFourierFeaturizing.cs +++ b/src/Microsoft.ML.Transforms/RandomFourierFeaturizing.cs @@ -429,7 +429,7 @@ private static IDataTransform Create(IHostEnvironment env, Options options, IDat item.Source ?? item.Name, (item.MatrixGenerator ?? options.MatrixGenerator).CreateComponent(env), item.Seed ?? options.Seed); - }; + } } return new ApproximatedKernelTransformer(env, input, cols).MakeDataTransform(input); } diff --git a/src/Microsoft.ML.Transforms/Text/NgramHashingTransformer.cs b/src/Microsoft.ML.Transforms/Text/NgramHashingTransformer.cs index 7f1d7f8b75..476441c742 100644 --- a/src/Microsoft.ML.Transforms/Text/NgramHashingTransformer.cs +++ b/src/Microsoft.ML.Transforms/Text/NgramHashingTransformer.cs @@ -355,7 +355,7 @@ private static IDataTransform Create(IHostEnvironment env, Options options, IDat item.MaximumNumberOfInverts ?? options.MaximumNumberOfInverts, item.RehashUnigrams ?? options.RehashUnigrams ); - }; + } } return new NgramHashingTransformer(env, input, cols).MakeDataTransform(input); } diff --git a/src/Microsoft.ML.Transforms/Text/NgramTransform.cs b/src/Microsoft.ML.Transforms/Text/NgramTransform.cs index d3703d165a..2a42cae127 100644 --- a/src/Microsoft.ML.Transforms/Text/NgramTransform.cs +++ b/src/Microsoft.ML.Transforms/Text/NgramTransform.cs @@ -429,7 +429,7 @@ internal static IDataTransform Create(IHostEnvironment env, Options options, IDa item.Weighting ?? options.Weighting, maxNumTerms, item.Source ?? item.Name); - }; + } } return new NgramExtractingTransformer(env, input, cols).MakeDataTransform(input); } diff --git a/src/Microsoft.ML.Transforms/Text/TokenizingByCharacters.cs b/src/Microsoft.ML.Transforms/Text/TokenizingByCharacters.cs index 61a42220f2..f323e297f4 100644 --- a/src/Microsoft.ML.Transforms/Text/TokenizingByCharacters.cs +++ b/src/Microsoft.ML.Transforms/Text/TokenizingByCharacters.cs @@ -258,7 +258,7 @@ private void SaveAsOnnxCore(OnnxContext ctx, int iinfo, string srcVariableName, node = ctx.CreateNode(opType, squeezeOutput, labelEncoderOutput, ctx.GetNodeName(opType)); IEnumerable charStrings = Enumerable.Range(0, 65535).Select(x => ((char)x).ToString()); - IEnumerable charValues = Enumerable.Range(0, 65535).Select(x => Convert.ToInt64(x)); ; + IEnumerable charValues = Enumerable.Range(0, 65535).Select(x => Convert.ToInt64(x)); node.AddAttribute("keys_strings", charStrings); node.AddAttribute("values_int64s", charValues);