Skip to content

Commit

Permalink
Remove Trace.WriteLine from RemoveInitializersFromInputs (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
nietras authored Jun 13, 2023
1 parent 9dc908d commit 7862453
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
<Project>
<PropertyGroup>
<Authors>nietras</Authors>
<Copyright>Copyright © nietras 2021</Copyright>
<Copyright>Copyright © nietras 2023</Copyright>
<NeutralLanguage>en</NeutralLanguage>
<AssemblyVersion>0.2.0.0</AssemblyVersion>
<FileVersion>0.2.0</FileVersion>
<FileVersion>0.2.1</FileVersion>
<InformationalVersion>$(FileVersion)</InformationalVersion>
<PackageVersion>$(InformationalVersion)</PackageVersion>

<!--https://blog.paranoidcoding.com/2016/04/05/deterministic-builds-in-roslyn.html-->
<Deterministic>true</Deterministic>
<LangVersion>9.0</LangVersion>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
</PropertyGroup>
</Project>
6 changes: 3 additions & 3 deletions src/OnnxSharp/GraphExtensions.Clean.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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}");
}
}
}
Expand All @@ -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];
Expand All @@ -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)
{
Expand Down

0 comments on commit 7862453

Please sign in to comment.