Skip to content

Commit

Permalink
Merge branch 'master' into feature/benchmark_test_static_shape
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyang2057 committed Aug 22, 2023
2 parents 5ef157b + 0499b7c commit bd09091
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/Nncase.Passes/Rules/Neutral/AddRangeOfAndMarker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,13 @@ public static bool CheckOp(Op op)
{
if (!pairs.ContainsKey(callParams[i]))
{
// 动态shape的情况下会先统计range再分段,matmul转conv2d则是需要知道shape才能做
// 动态shape情况下执行的顺序是range -> 分段 -> matmul转conv2d
// 这里必须要对matmul的rhs进行判断,如果matmul是动态的那么不会走量化,如果是静态的那么一定会转到conv2d
// 因此认为matmul的rhs为const的情况下一定能转成conv2d
bool isWeights = ((call.Target is Conv2D || call.Target is Conv2DTranspose) && (i == 1))
|| (call.Target is LSTM && i > 0);
|| (call.Target is LSTM && i > 0)
|| (call.Target is MatMul && i == 1 && callParams[1] is TensorConst);

if (!configExist && !useAutoMixQuant)
{
Expand Down
5 changes: 1 addition & 4 deletions src/Nncase.Tests.TestFixture/TransformBase/Compare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,7 @@ public static bool TensorValueCompare(TensorValue pre, TensorValue post, float t

public static bool TupleValueCompare(TupleValue a, TupleValue b, float thresh = 0.99f)
{
if (a.Count != b.Count)
{
return false;
}
Assert.Equal(a.Count, b.Count);

foreach (var (t1, t2) in a.AsTensors().Zip(b.AsTensors()))
{
Expand Down

0 comments on commit bd09091

Please sign in to comment.