Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix metadata #1132

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Nncase.Passes/Rules/Neutral/FoldDilatedConv2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
(Conv2D.Stride.Index, (Expr)new[] { strideH, strideW }),
(Conv2D.Dilation.Index, (Expr)new[] { dilationH, dilationW }),
};
return ReplaceUtility.ReplaceCallParams(conv, conv.Arguments.ToArray(), pairs);
return ReplaceUtility.ReplaceCallParams(conv, conv.Arguments.ToArray(), pairs).InheritMetaData(btsCall);

Check warning on line 100 in src/Nncase.Passes/Rules/Neutral/FoldDilatedConv2D.cs

View check run for this annotation

Codecov / codecov/patch

src/Nncase.Passes/Rules/Neutral/FoldDilatedConv2D.cs#L100

Added line #L100 was not covered by tests
}

private (int[] Begin, int[] End) GetBeginEnd(int[] btsBlockShape, int[,] crop, int[] btsInputShape)
Expand Down
1 change: 1 addition & 0 deletions src/Nncase.Passes/Rules/Neutral/SwapBinaryArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Linq;
using Nncase.IR;
using Nncase.PatternMatch;
using Nncase.Utilities;
using static Nncase.Passes.Utility;
using static Nncase.PatternMatch.F.Math;
using static Nncase.PatternMatch.Utility;
Expand Down
8 changes: 4 additions & 4 deletions src/Nncase.Passes/Rules/WithMarker/CombineTranspose.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
// transpose(leakyrelu(transpose(input))) => leakyRelu(transpose(transpose(input)))
else
{
return outMarker.With(target: Transpose(outMarker.With(target: Transpose(outMarker.With(target: LeakyRelu(inMarker.With(target: input), alpha)), perm1)), perm2));
return outMarker.With(target: Transpose(outMarker.With(target: Transpose(outMarker.With(target: LeakyRelu(inMarker.With(target: input), alpha).InheritMetaData(call)), perm1)), perm2));

Check warning on line 210 in src/Nncase.Passes/Rules/WithMarker/CombineTranspose.cs

View check run for this annotation

Codecov / codecov/patch

src/Nncase.Passes/Rules/WithMarker/CombineTranspose.cs#L210

Added line #L210 was not covered by tests
}
}
}
Expand Down Expand Up @@ -239,7 +239,7 @@
"outMarker"),
IsWildcard("perm2"));

private Expr? GetReplace(int[] perm1, int[] perm2, Expr input, Expr rhs, Marker bnMarker, Marker outMarker, Expr alpha)
private Expr? GetReplace(int[] perm1, int[] perm2, Expr input, Expr rhs, Marker bnMarker, Marker outMarker, Expr alpha, Expr call, Expr bnCall)
{
if (perm1.SequenceEqual(new[] { 0, 2, 3, 1 }) && perm2.SequenceEqual(new[] { 0, 3, 1, 2 }))
{
Expand All @@ -248,10 +248,10 @@
if (rhs is Marker m)
{
var constRhs = m.With(target: Reshape(m.Target, new[] { rhs.CheckedShape.Size, 1, 1 }).Evaluate().AsTensor());
return outMarker.With(target: LeakyRelu(bnMarker.With(target: Add(input, constRhs)), alpha));
return outMarker.With(target: LeakyRelu(bnMarker.With(target: Add(input, constRhs).InheritMetaData(bnCall)), alpha).InheritMetaData(call));

Check warning on line 251 in src/Nncase.Passes/Rules/WithMarker/CombineTranspose.cs

View check run for this annotation

Codecov / codecov/patch

src/Nncase.Passes/Rules/WithMarker/CombineTranspose.cs#L251

Added line #L251 was not covered by tests
}

return outMarker.With(target: LeakyRelu(bnMarker.With(target: Add(input, Reshape(rhs, new[] { rhs.CheckedShape.Size, 1, 1 }))), alpha));
return outMarker.With(target: LeakyRelu(bnMarker.With(target: Add(input, Reshape(rhs, new[] { rhs.CheckedShape.Size, 1, 1 }))), alpha).InheritMetaData(call));

Check warning on line 254 in src/Nncase.Passes/Rules/WithMarker/CombineTranspose.cs

View check run for this annotation

Codecov / codecov/patch

src/Nncase.Passes/Rules/WithMarker/CombineTranspose.cs#L254

Added line #L254 was not covered by tests
}

return null;
Expand Down
Loading