From d14ae856ce7837c91d4e0c7123aa25c7d62f5b69 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Mon, 17 Oct 2022 15:05:37 +0800 Subject: [PATCH] fix(imperative): update region restricted conv testcase for bias shape GitOrigin-RevId: 8bf66e7312d2649ae91dde54f7e8218bbdeea7f9 --- .../python/test/unit/functional/test_functional.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/imperative/python/test/unit/functional/test_functional.py b/imperative/python/test/unit/functional/test_functional.py index bcde10708..3a536fdbb 100644 --- a/imperative/python/test/unit/functional/test_functional.py +++ b/imperative/python/test/unit/functional/test_functional.py @@ -1008,7 +1008,7 @@ def test_region_restricted_conv_forward_backward_cuda(bias): rin = tensor(np.ones(rin_shape).astype(np.int32), device="cpu0") rout = tensor(np.ones(rout_shape).astype(np.int32), device="cpu0") bias_cpu = ( - tensor(np.ones(diff_shape).astype(np.float32), device="cpu0") + tensor(np.ones((1, GROUP * OCPG, 1, 1)).astype(np.float32), device="cpu0") if bias else None ) @@ -1033,7 +1033,9 @@ def test_region_restricted_conv_forward_backward_cuda(bias): rin = tensor(np.ones(rin_shape).astype(np.int32), device=handle) rout = tensor(np.ones(rout_shape).astype(np.int32), device=handle) bias_gpu = ( - tensor(np.ones(diff_shape).astype(np.float32), device=handle) if bias else None + tensor(np.ones((1, GROUP * OCPG, 1, 1)).astype(np.float32), device=handle) + if bias + else None ) gm = GradManager().attach([src, filter]) with gm: @@ -1085,7 +1087,7 @@ def test_region_restricted_conv_forward_backward_uint8(bias): rin = tensor(np.ones(rin_shape).astype(np.int32), device="cpu0") rout = tensor(np.ones(rout_shape).astype(np.int32), device="cpu0") bias_cpu = ( - tensor(np.ones(diff_shape).astype(np.float32), device="cpu0") + tensor(np.ones((1, GROUP * OCPG, 1, 1)).astype(np.float32), device="cpu0") if bias else None ) @@ -1111,7 +1113,9 @@ def test_region_restricted_conv_forward_backward_uint8(bias): rin = tensor(np.ones(rin_shape).astype(np.uint8), device=handle) rout = tensor(np.ones(rout_shape).astype(np.uint8), device=handle) bias_gpu = ( - tensor(np.ones(diff_shape).astype(np.float32), device=handle) if bias else None + tensor(np.ones((1, GROUP * OCPG, 1, 1)).astype(np.float32), device=handle) + if bias + else None ) gm = GradManager().attach([src, filter]) -- GitLab