From 7862453c3f5390662d1601e1341b119af364e8e0 Mon Sep 17 00:00:00 2001 From: nietras Date: Tue, 13 Jun 2023 11:18:36 +0200 Subject: [PATCH] Remove Trace.WriteLine from RemoveInitializersFromInputs (#6) --- src/Directory.Build.props | 5 +++-- src/OnnxSharp/GraphExtensions.Clean.cs | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index c01411a..9b59383 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,15 +2,16 @@ nietras - Copyright © nietras 2021 + Copyright © nietras 2023 en 0.2.0.0 - 0.2.0 + 0.2.1 $(FileVersion) $(InformationalVersion) true 9.0 + false \ No newline at end of file diff --git a/src/OnnxSharp/GraphExtensions.Clean.cs b/src/OnnxSharp/GraphExtensions.Clean.cs index 9720f12..ed2e561 100644 --- a/src/OnnxSharp/GraphExtensions.Clean.cs +++ b/src/OnnxSharp/GraphExtensions.Clean.cs @@ -29,7 +29,7 @@ public static void RemoveInitializersFromInputs(this GraphProto graph) { // https://github.com/protocolbuffers/protobuf/blob/master/csharp/src/Google.Protobuf/Collections/RepeatedField.cs var removed = inputs.Remove(input); - Trace.WriteLine($"{removed} {inputs.Count}"); + Debug.Assert(removed, $"{removed} {inputs.Count}"); } } } @@ -55,7 +55,7 @@ public static void RemoveUnnecessaryInitializerReshapes(this GraphProto graph) var outputs = node.Output; // Expected Reshape takes 2 inputs and has 1 output - if (inputs.Count == opSpec.Inputs && outputs.Count == opSpec.Outputs) + if (inputs.Count == opSpec.Inputs && outputs.Count == opSpec.Outputs) { var dataName = inputs[0]; var shapeName = inputs[1]; @@ -70,7 +70,7 @@ public static void RemoveUnnecessaryInitializerReshapes(this GraphProto graph) var outputShapeValue = valueInfos.Single(v => v.Name, reshapeOutputName); var outputShapeDims = outputShapeValue.Type.TensorType.Shape.Dim; - var allValue = outputShapeDims.All(d => d.ValueCase == + var allValue = outputShapeDims.All(d => d.ValueCase == TensorShapeProto.Types.Dimension.ValueOneofCase.DimValue); if (allValue) {