From a5d23b64f13ea9babc65a9daa758cdf15da24c4c Mon Sep 17 00:00:00 2001 From: optima2005 <56945758+optima2005@users.noreply.github.com> Date: Thu, 9 Jan 2020 02:26:14 +0800 Subject: [PATCH] [CONV] Reduce data size of asymmetric padding testcase (#4658) Co-authored-by: Tianqi Chen --- topi/tests/python/test_topi_conv2d_NCHWc.py | 29 +++++++++--------- topi/tests/python/test_topi_conv2d_int8.py | 20 ++++++------- topi/tests/python/test_topi_conv2d_nchw.py | 30 +++++++++---------- .../tests/python/test_topi_conv2d_winograd.py | 20 ++++++------- 4 files changed, 50 insertions(+), 49 deletions(-) diff --git a/topi/tests/python/test_topi_conv2d_NCHWc.py b/topi/tests/python/test_topi_conv2d_NCHWc.py index 6eada11ae7630..af585904293f4 100644 --- a/topi/tests/python/test_topi_conv2d_NCHWc.py +++ b/topi/tests/python/test_topi_conv2d_NCHWc.py @@ -220,20 +220,21 @@ def test_conv2d_NCHWc(): verify_conv2d_NCHWc(1, 256, 3, 126, 3, 1, 1) # Asymmetric padding - verify_conv2d_NCHWc(1, 3, 224, 64, 7, 2, (0, 0, 1, 1)) - verify_conv2d_NCHWc(1, 64, 56, 128, 3, 1, (3, 3, 2, 2)) - verify_conv2d_NCHWc(1, 64, 56, 64, 1, 1, (1, 2, 2, 1)) - verify_conv2d_NCHWc(1, 64, 288, 192, 1, 1, (1, 2)) - verify_conv2d_NCHWc(1, 64, 56, 64, 3, 1, (3, 1)) - verify_conv2d_NCHWc(1, 128, 56, 384, 3, 1, (0, 2)) - verify_conv2d_NCHWc(1, 64, 56, 64, 1, 1, "VALID") - verify_conv2d_NCHWc(1, 388, 56, 64, 3, 1, "VALID") - verify_conv2d_NCHWc(1, 512, 19, 64, 1, 1, "SAME") - verify_conv2d_NCHWc(1, 64, 16, 32, 2, 1, "SAME") - verify_conv2d_NCHWc(1, 64, 56, 64, 3, 1, (1, 2, 2, 1), add_relu=True) - verify_conv2d_NCHWc(1, 64, 56, 64, 5, 2, (1, 3), add_bias=True) - verify_conv2d_NCHWc(1, 64, 56, 64, 3, 1, "VALID", add_bias=True, add_relu=True) - verify_conv2d_NCHWc(1, 64, 56, 64, 24, 1, "SAME", add_bias=True, add_relu=True) + verify_conv2d_NCHWc(1, 32, 17, 64, 7, 2, (0, 0, 1, 1)) + verify_conv2d_NCHWc(1, 32, 35, 128, 3, 1, (3, 3, 2, 2)) + verify_conv2d_NCHWc(1, 32, 35, 32, 1, 1, (1, 2, 2, 1)) + verify_conv2d_NCHWc(1, 32, 17, 192, 1, 1, (1, 2)) + verify_conv2d_NCHWc(1, 32, 8, 32, 3, 1, (3, 1)) + verify_conv2d_NCHWc(1, 128, 8, 384, 3, 1, (0, 2)) + verify_conv2d_NCHWc(1, 32, 8, 32, 1, 1, "VALID") + verify_conv2d_NCHWc(1, 388, 8, 32, 3, 1, "VALID") + verify_conv2d_NCHWc(1, 512, 19, 32, 1, 1, "SAME") + verify_conv2d_NCHWc(1, 32, 10, 32, 2, 1, "SAME") + verify_conv2d_NCHWc(1, 32, 8, 32, 3, 1, (1, 2, 2, 1), add_relu=True) + verify_conv2d_NCHWc(1, 32, 8, 32, 5, 2, (1, 3), add_bias=True) + verify_conv2d_NCHWc(1, 32, 8, 32, 3, 1, "VALID", add_bias=True, add_relu=True) + verify_conv2d_NCHWc(1, 32, 8, 32, 24, 1, "SAME", add_bias=True, add_relu=True) + if __name__ == "__main__": diff --git a/topi/tests/python/test_topi_conv2d_int8.py b/topi/tests/python/test_topi_conv2d_int8.py index 7ca5c04f72c72..6cb66d0135416 100644 --- a/topi/tests/python/test_topi_conv2d_int8.py +++ b/topi/tests/python/test_topi_conv2d_int8.py @@ -188,18 +188,18 @@ def test_conv2d_nchw(): verify_conv2d_NCHWc_int8(32, 32, 149, 32, 3, 1, 0) # Asymmetric padding - verify_conv2d_NCHWc_int8(1, 32, 224, 64, 7, 2, (0, 0, 1, 1)) - verify_conv2d_NCHWc_int8(1, 64, 56, 128, 3, 1, (3, 3, 2, 2)) - verify_conv2d_NCHWc_int8(1, 64, 56, 64, 1, 1, (1, 2, 2, 1)) - verify_conv2d_NCHWc_int8(1, 64, 288, 192, 1, 1, (1, 2)) - verify_conv2d_NCHWc_int8(1, 64, 56, 64, 3, 1, (3, 1)) - verify_conv2d_NCHWc_int8(1, 128, 56, 384, 3, 1, (0, 2)) - verify_conv2d_NCHWc_int8(1, 64, 56, 64, 1, 1, "VALID") - verify_conv2d_NCHWc_int8(1, 388, 56, 64, 3, 1, "VALID") + verify_conv2d_NCHWc_int8(1, 32, 35, 64, 7, 2, (0, 0, 1, 1)) + verify_conv2d_NCHWc_int8(1, 64, 8, 128, 3, 1, (3, 3, 2, 2)) + verify_conv2d_NCHWc_int8(1, 64, 8, 64, 1, 1, (1, 2, 2, 1)) + verify_conv2d_NCHWc_int8(1, 64, 17, 192, 1, 1, (1, 2)) + verify_conv2d_NCHWc_int8(1, 64, 8, 64, 3, 1, (3, 1)) + verify_conv2d_NCHWc_int8(1, 128, 8, 384, 3, 1, (0, 2)) + verify_conv2d_NCHWc_int8(1, 64, 8, 64, 1, 1, "VALID") + verify_conv2d_NCHWc_int8(1, 388, 8, 64, 3, 1, "VALID") verify_conv2d_NCHWc_int8(1, 512, 19, 64, 1, 1, "SAME") verify_conv2d_NCHWc_int8(1, 64, 16, 32, 2, 1, "SAME") - verify_conv2d_NCHWc_int8(1, 64, 56, 64, 3, 1, (1, 2, 2, 1), add_relu=True) - verify_conv2d_NCHWc_int8(1, 64, 56, 64, 5, 2, (1, 3), add_bias=True) + verify_conv2d_NCHWc_int8(1, 64, 8, 64, 3, 1, (1, 2, 2, 1), add_relu=True) + verify_conv2d_NCHWc_int8(1, 64, 8, 64, 5, 2, (1, 3), add_bias=True) verify_conv2d_NCHWc_int8(1, 64, 56, 64, 3, 1, "VALID", add_bias=True, add_relu=True) verify_conv2d_NCHWc_int8(1, 64, 56, 64, 24, 1, "SAME", add_bias=True, add_relu=True) diff --git a/topi/tests/python/test_topi_conv2d_nchw.py b/topi/tests/python/test_topi_conv2d_nchw.py index 9f5a56098f989..85d733c5d5465 100644 --- a/topi/tests/python/test_topi_conv2d_nchw.py +++ b/topi/tests/python/test_topi_conv2d_nchw.py @@ -185,23 +185,23 @@ def test_conv2d_nchw(): verify_conv2d_nchw(1, 256, 3, 126, 3, 1, 1) # Asymmetric padding - verify_conv2d_nchw(1, 3, 224, 64, 7, 2, (0, 0, 1, 1)) - verify_conv2d_nchw(1, 64, 56, 128, 3, 1, (3, 3, 2, 2)) - verify_conv2d_nchw(1, 64, 56, 64, 1, 1, (1, 2, 2, 1)) - verify_conv2d_nchw(1, 64, 288, 192, 1, 1, (1, 2)) - verify_conv2d_nchw(1, 64, 56, 64, 3, 1, (3, 1)) - verify_conv2d_nchw(1, 128, 56, 384, 3, 1, (0, 2)) - verify_conv2d_nchw(1, 64, 384, 64, 3, 1, (1, 2), use_cudnn=True) - verify_conv2d_nchw(1, 64, 56, 64, 1, 1, "VALID") - verify_conv2d_nchw(1, 388, 56, 64, 3, 1, "VALID") - verify_conv2d_nchw(1, 64, 20, 48, 3, 1, "VALID", use_cudnn=True) + verify_conv2d_nchw(1, 3, 35, 64, 7, 2, (0, 0, 1, 1)) + verify_conv2d_nchw(1, 64, 8, 128, 3, 1, (3, 3, 2, 2)) + verify_conv2d_nchw(1, 64, 8, 64, 1, 1, (1, 2, 2, 1)) + verify_conv2d_nchw(1, 64, 17, 192, 1, 1, (1, 2)) + verify_conv2d_nchw(1, 64, 8, 64, 3, 1, (3, 1)) + verify_conv2d_nchw(1, 128, 8, 384, 3, 1, (0, 2)) + verify_conv2d_nchw(1, 64, 35, 64, 3, 1, (1, 2), use_cudnn=True) + verify_conv2d_nchw(1, 64, 8, 64, 1, 1, "VALID") + verify_conv2d_nchw(1, 388, 8, 64, 3, 1, "VALID") + verify_conv2d_nchw(1, 64, 10, 48, 3, 1, "VALID", use_cudnn=True) verify_conv2d_nchw(1, 512, 19, 64, 1, 1, "SAME") - verify_conv2d_nchw(1, 64, 16, 32, 2, 1, "SAME") + verify_conv2d_nchw(1, 64, 5, 32, 2, 1, "SAME") verify_conv2d_nchw(1, 64, 8, 64, 3, 1, "SAME", use_cudnn=True) - verify_conv2d_nchw(1, 64, 56, 64, 3, 1, (1, 2, 2, 1), add_relu=True) - verify_conv2d_nchw(1, 64, 56, 64, 5, 2, (1, 3), add_bias=True) - verify_conv2d_nchw(1, 64, 56, 64, 3, 1, "VALID", add_bias=True, add_relu=True) - verify_conv2d_nchw(1, 64, 56, 64, 24, 1, "SAME", add_bias=True, add_relu=True) + verify_conv2d_nchw(1, 64, 8, 64, 3, 1, (1, 2, 2, 1), add_relu=True) + verify_conv2d_nchw(1, 64, 8, 64, 5, 2, (1, 3), add_bias=True) + verify_conv2d_nchw(1, 64, 8, 64, 3, 1, "VALID", add_bias=True, add_relu=True) + verify_conv2d_nchw(1, 64, 8, 64, 24, 1, "SAME", add_bias=True, add_relu=True) if __name__ == "__main__": diff --git a/topi/tests/python/test_topi_conv2d_winograd.py b/topi/tests/python/test_topi_conv2d_winograd.py index 548aea909cae6..350e62101689a 100644 --- a/topi/tests/python/test_topi_conv2d_winograd.py +++ b/topi/tests/python/test_topi_conv2d_winograd.py @@ -136,18 +136,18 @@ def test_conv2d_nchw(): verify_conv2d_nchw(2, 13, 71, 59, 3, 1, 1) # Asymmetric padding - verify_conv2d_nchw(1, 64, 56, 64, 3, 1, (1, 1, 1, 1)) - verify_conv2d_nchw(1, 128, 28, 128, 3, 1, (1, 1, 1, 1)) - verify_conv2d_nchw(1, 256, 14, 256, 3, 1, (1, 1)) + verify_conv2d_nchw(1, 48, 56, 48, 3, 1, (1, 1, 1, 1)) + verify_conv2d_nchw(1, 64, 28, 64, 3, 1, (1, 1, 1, 1)) + verify_conv2d_nchw(1, 128, 14, 128, 3, 1, (1, 1)) verify_conv2d_nchw(1, 512, 7, 512, 3, 1, "SAME") - verify_conv2d_nchw(2, 13, 71, 59, 3, 1, (1, 1, 1, 1)) - verify_conv2d_nchw(2, 64, 56, 64, 3, 1, (1, 1, 1, 1), add_bias=True) - verify_conv2d_nchw(2, 64, 56, 64, 3, 1, (1, 1), add_relu=True) - verify_conv2d_nchw(2, 64, 56, 64, 3, 1, "SAME", add_relu=True, add_bias=True) - verify_conv2d_nchw(1, 128, 17, 192, 7, 1, (3, 1), devices=['cuda']) - verify_conv2d_nchw(1, 128, 17, 128, 7, 1, (3, 3, 2, 2), devices=['cuda']) + verify_conv2d_nchw(2, 13, 71, 59, 3, 1, (1, 1, 1, 1)) + verify_conv2d_nchw(2, 48, 56, 48, 3, 1, (1, 1, 1, 1), add_bias=True) + verify_conv2d_nchw(2, 48, 56, 48, 3, 1, (1, 1), add_relu=True) + verify_conv2d_nchw(2, 48, 56, 48, 3, 1, "SAME", add_relu=True, add_bias=True) + verify_conv2d_nchw(1, 64, 17, 192, 7, 1, (3, 1), devices=['cuda']) + verify_conv2d_nchw(1, 64, 17, 64, 7, 1, (3, 3, 2, 2), devices=['cuda']) verify_conv2d_nchw(1, 160, 17, 160, 7, 1, "SAME", devices=['cuda']) - verify_conv2d_nchw(1, 48, 35, 64, 5, 1, "VALID", devices=['cuda']) + verify_conv2d_nchw(1, 48, 35, 48, 5, 1, "VALID", devices=['cuda']) if __name__ == "__main__":