diff --git a/src/Nncase.Core/IR/Expr.cs b/src/Nncase.Core/IR/Expr.cs index 3ae35627d8..f7345c8fd8 100644 --- a/src/Nncase.Core/IR/Expr.cs +++ b/src/Nncase.Core/IR/Expr.cs @@ -94,6 +94,8 @@ public Shape CheckedShape { case TensorType type: return type.Shape; + case DistributedType type: + return type.TensorType.Shape; default: if (DumpScope.Current.IsEnabled(DumpFlags.Compile)) { diff --git a/src/Nncase.Core/Schedule/ScheduleTypes.cs b/src/Nncase.Core/Schedule/ScheduleTypes.cs index 6800f79fad..79b0498fd2 100644 --- a/src/Nncase.Core/Schedule/ScheduleTypes.cs +++ b/src/Nncase.Core/Schedule/ScheduleTypes.cs @@ -164,7 +164,7 @@ public MemoryRange MemoryRange { code = PrimTypeCodes.ToTypeCode(DType); } - catch (System.Collections.Generic.KeyNotFoundException e) + catch (System.Collections.Generic.KeyNotFoundException) { if (DType.SizeInBytes == 4) { @@ -172,7 +172,7 @@ public MemoryRange MemoryRange } else { - throw e; + throw; } } diff --git a/src/Nncase.Passes/Rules/Neutral/FoldBinary.cs b/src/Nncase.Passes/Rules/Neutral/FoldBinary.cs index 2e03918bec..44abaa3d2d 100644 --- a/src/Nncase.Passes/Rules/Neutral/FoldBinary.cs +++ b/src/Nncase.Passes/Rules/Neutral/FoldBinary.cs @@ -34,7 +34,6 @@ public sealed partial class FoldNopBinary : IRewriteRule (BinaryOp.Add, 0f) => lhs, (BinaryOp.Sub, 0f) => lhs, (BinaryOp.Mul, 1f) => lhs, - (BinaryOp.Mod, 1f) => lhs, (BinaryOp.Pow, 1f) => lhs, (BinaryOp.Div, 1f) => lhs, _ => null, diff --git a/src/Nncase.Quantization/Quantization/Quantizer.cs b/src/Nncase.Quantization/Quantization/Quantizer.cs index 961ae8b716..c9b5fa9daa 100644 --- a/src/Nncase.Quantization/Quantization/Quantizer.cs +++ b/src/Nncase.Quantization/Quantization/Quantizer.cs @@ -167,10 +167,10 @@ public async Task RunAsync(RunPassContext options) var histograms = await GetHistogramsAsync(_quantizeOptions.CalibrationDataset, ranges, srcBinSize, dstBinSize); // 1.2. Select best ranges - var optRanges = GetOptRanges(histograms, ranges, srcBinSize, dstBinSize, _quantizeOptions.CalibrationMethod); + ranges = GetOptRanges(histograms, ranges, srcBinSize, dstBinSize, _quantizeOptions.CalibrationMethod); // 1.3. Assign ranges - AssignRanges(optRanges); + AssignRanges(ranges); } else { // 2. Assign ranges diff --git a/src/Nncase.Tests/Quant/UnitTestExportQuantScheme.cs b/src/Nncase.Tests/Quant/UnitTestExportQuantScheme.cs index 254d5cf265..8f2dd62685 100644 --- a/src/Nncase.Tests/Quant/UnitTestExportQuantScheme.cs +++ b/src/Nncase.Tests/Quant/UnitTestExportQuantScheme.cs @@ -92,7 +92,7 @@ private async Task TestExportQuantSchemeMainPassesAsync(Var input, var pmgr = CompileSession.CreatePassManager("Passes"); CompileOptions.QuantizeOptions.CalibrationDataset = new SolidCalibrationDatasetProvider(new Var[] { input }); - CompileOptions.QuantizeOptions.CalibrationMethod = CalibMethod.Kld; + CompileOptions.QuantizeOptions.CalibrationMethod = CalibMethod.NoClip; CompileOptions.QuantizeOptions.ExportQuantScheme = true; CompileOptions.QuantizeOptions.ExportWeightRangeByChannel = exportWeightRangeByChannel;