Skip to content

Commit

Permalink
test++
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Jul 16, 2023
1 parent d31a804 commit 5ae3088
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/layer/x86/convolution_packed_int8.h
Original file line number Diff line number Diff line change
Expand Up @@ -935,8 +935,6 @@ static void convolution_packed_int8(const Mat& bottom_blob, Mat& top_blob, const

const int M = top_blob.cstep * out_elempack;

NCNN_LOGE("convolution_packed_int8 %d @ %d -> %d @ %d", inch, elempack, outch, out_elempack);

const int maxk = kernel_w * kernel_h;

// kernel offsets
Expand Down
4 changes: 4 additions & 0 deletions tests/test_convolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila
if (ret != 0)
{
fprintf(stderr, "test_convolution failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d act=%d actparams=[%f,%f]\n", w, h, c, outch, kernel, dilation, stride, pad, bias, activation_type, activation_params[0], activation_params[1]);
return ret;
}

{
Expand All @@ -65,6 +66,7 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila
if (ret != 0)
{
fprintf(stderr, "test_convolution failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d act=%d actparams=[%f,%f]\n", w, h, c, outch, kernel, dilation, stride, pad, bias, activation_type, activation_params[0], activation_params[1]);
return ret;
}
}

Expand All @@ -85,6 +87,7 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila
if (ret != 0)
{
fprintf(stderr, "test_convolution failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d act=%d actparams=[%f,%f]\n", w, h, c, outch, kernel, dilation, stride, pad, bias, activation_type, activation_params[0], activation_params[1]);
return ret;
}
}

Expand All @@ -98,6 +101,7 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila
if (ret != 0)
{
fprintf(stderr, "test_convolution failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d act=%d actparams=[%f,%f]\n", w, h, c, outch, kernel, dilation, stride, pad, bias, activation_type, activation_params[0], activation_params[1]);
return ret;
}
}
#endif // __aarch64__
Expand Down
4 changes: 4 additions & 0 deletions tests/test_convolution_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila
if (ret != 0)
{
fprintf(stderr, "test_convolution failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d act=%d actparams=[%f,%f]\n", w, h, c, outch, kernel, dilation, stride, pad, bias, activation_type, activation_params[0], activation_params[1]);
return ret;
}

{
Expand All @@ -65,6 +66,7 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila
if (ret != 0)
{
fprintf(stderr, "test_convolution failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d act=%d actparams=[%f,%f]\n", w, h, c, outch, kernel, dilation, stride, pad, bias, activation_type, activation_params[0], activation_params[1]);
return ret;
}
}

Expand All @@ -85,6 +87,7 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila
if (ret != 0)
{
fprintf(stderr, "test_convolution failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d act=%d actparams=[%f,%f]\n", w, h, c, outch, kernel, dilation, stride, pad, bias, activation_type, activation_params[0], activation_params[1]);
return ret;
}
}

Expand All @@ -98,6 +101,7 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila
if (ret != 0)
{
fprintf(stderr, "test_convolution failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d act=%d actparams=[%f,%f]\n", w, h, c, outch, kernel, dilation, stride, pad, bias, activation_type, activation_params[0], activation_params[1]);
return ret;
}
}
#endif // __aarch64__
Expand Down
4 changes: 4 additions & 0 deletions tests/test_convolution_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila
if (ret != 0)
{
fprintf(stderr, "test_convolution failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d act=%d actparams=[%f,%f]\n", w, h, c, outch, kernel, dilation, stride, pad, bias, activation_type, activation_params[0], activation_params[1]);
return ret;
}

{
Expand All @@ -67,6 +68,7 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila
if (ret != 0)
{
fprintf(stderr, "test_convolution failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d act=%d actparams=[%f,%f]\n", w, h, c, outch, kernel, dilation, stride, pad, bias, activation_type, activation_params[0], activation_params[1]);
return ret;
}
}

Expand All @@ -87,6 +89,7 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila
if (ret != 0)
{
fprintf(stderr, "test_convolution failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d act=%d actparams=[%f,%f]\n", w, h, c, outch, kernel, dilation, stride, pad, bias, activation_type, activation_params[0], activation_params[1]);
return ret;
}
}

Expand All @@ -99,6 +102,7 @@ static int test_convolution(int w, int h, int c, int outch, int kernel, int dila
if (ret != 0)
{
fprintf(stderr, "test_convolution failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d act=%d actparams=[%f,%f]\n", w, h, c, outch, kernel, dilation, stride, pad, bias, activation_type, activation_params[0], activation_params[1]);
return ret;
}
}

Expand Down
81 changes: 81 additions & 0 deletions tests/test_convolution_3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ static int test_convolution_int8(int w, int h, int c, int outch, int kernel, int
if (ret != 0)
{
fprintf(stderr, "test_convolution_int8 failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d requant=%d act=%d actparams=[%f,%f]\n", w, h, c, outch, kernel, dilation, stride, pad, bias, requant, activation_type, activation_params[0], activation_params[1]);
return ret;
}

{
Expand All @@ -206,6 +207,7 @@ static int test_convolution_int8(int w, int h, int c, int outch, int kernel, int
if (ret != 0)
{
fprintf(stderr, "test_convolution_int8 failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d requant=%d act=%d actparams=[%f,%f]\n", w, h, c, outch, kernel, dilation, stride, pad, bias, requant, activation_type, activation_params[0], activation_params[1]);
return ret;
}
}

Expand All @@ -226,6 +228,7 @@ static int test_convolution_int8(int w, int h, int c, int outch, int kernel, int
if (ret != 0)
{
fprintf(stderr, "test_convolution_int8 failed w=%d h=%d c=%d outch=%d kernel=%d dilation=%d stride=%d pad=%d bias=%d requant=%d act=%d actparams=[%f,%f]\n", w, h, c, outch, kernel, dilation, stride, pad, bias, requant, activation_type, activation_params[0], activation_params[1]);
return ret;
}
}

Expand Down Expand Up @@ -309,6 +312,83 @@ static int test_convolution_1()
|| test_convolution_int8(25, 33, 16, 15, 3, 1, 1, 1, 0)
|| test_convolution_int8(7, 7, 15, 12, 3, 1, 1, 1, 0);
}

static int test_convolution_1_2()
{
return 0
|| test_convolution_int8(19, 17, 1, 1, 3, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 2, 1, 3, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 7, 1, 3, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 8, 1, 3, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 15, 1, 3, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 16, 1, 3, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 31, 1, 3, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 32, 1, 3, 2, 2, 0, 0)

|| test_convolution_int8(19, 17, 1, 2, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 2, 2, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 7, 2, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 8, 2, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 15, 2, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 16, 2, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 31, 2, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 32, 2, 5, 2, 2, 0, 0)

|| test_convolution_int8(19, 17, 1, 7, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 2, 7, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 7, 7, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 8, 7, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 15, 7, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 16, 7, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 31, 7, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 32, 7, 5, 2, 2, 0, 0)

|| test_convolution_int8(19, 17, 1, 8, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 2, 8, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 7, 8, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 8, 8, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 15, 8, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 16, 8, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 31, 8, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 32, 8, 5, 2, 2, 0, 0)

|| test_convolution_int8(19, 17, 1, 15, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 2, 15, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 7, 15, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 8, 15, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 15, 15, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 16, 15, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 31, 15, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 32, 15, 5, 2, 2, 0, 0)

|| test_convolution_int8(19, 17, 1, 16, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 2, 16, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 7, 16, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 8, 16, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 15, 16, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 16, 16, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 31, 16, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 32, 16, 5, 2, 2, 0, 0)

|| test_convolution_int8(19, 17, 1, 31, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 2, 31, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 7, 31, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 8, 31, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 15, 31, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 16, 31, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 31, 31, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 32, 31, 5, 2, 2, 0, 0)

|| test_convolution_int8(19, 17, 1, 32, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 2, 32, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 7, 32, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 8, 32, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 15, 32, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 16, 32, 5, 2, 2, 0, 0)
|| test_convolution_int8(19, 17, 31, 32, 5, 2, 2, 0, 1)
|| test_convolution_int8(19, 17, 32, 32, 5, 2, 2, 0, 0)
;
}
#endif // NCNN_INT8

int main()
Expand All @@ -318,6 +398,7 @@ int main()
#if NCNN_INT8
return 0
|| test_convolution_1()
|| test_convolution_1_2()
|| test_convolution_2()
|| test_convolution_3();
#else
Expand Down

0 comments on commit 5ae3088

Please sign in to comment.