提交 d14ae856 编写于 作者: M Megvii Engine Team

fix(imperative): update region restricted conv testcase for bias shape

GitOrigin-RevId: 8bf66e7312d2649ae91dde54f7e8218bbdeea7f9
上级 ffb62624
...@@ -1008,7 +1008,7 @@ def test_region_restricted_conv_forward_backward_cuda(bias): ...@@ -1008,7 +1008,7 @@ def test_region_restricted_conv_forward_backward_cuda(bias):
rin = tensor(np.ones(rin_shape).astype(np.int32), device="cpu0") rin = tensor(np.ones(rin_shape).astype(np.int32), device="cpu0")
rout = tensor(np.ones(rout_shape).astype(np.int32), device="cpu0") rout = tensor(np.ones(rout_shape).astype(np.int32), device="cpu0")
bias_cpu = ( 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 if bias
else None else None
) )
...@@ -1033,7 +1033,9 @@ def test_region_restricted_conv_forward_backward_cuda(bias): ...@@ -1033,7 +1033,9 @@ def test_region_restricted_conv_forward_backward_cuda(bias):
rin = tensor(np.ones(rin_shape).astype(np.int32), device=handle) rin = tensor(np.ones(rin_shape).astype(np.int32), device=handle)
rout = tensor(np.ones(rout_shape).astype(np.int32), device=handle) rout = tensor(np.ones(rout_shape).astype(np.int32), device=handle)
bias_gpu = ( 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]) gm = GradManager().attach([src, filter])
with gm: with gm:
...@@ -1085,7 +1087,7 @@ def test_region_restricted_conv_forward_backward_uint8(bias): ...@@ -1085,7 +1087,7 @@ def test_region_restricted_conv_forward_backward_uint8(bias):
rin = tensor(np.ones(rin_shape).astype(np.int32), device="cpu0") rin = tensor(np.ones(rin_shape).astype(np.int32), device="cpu0")
rout = tensor(np.ones(rout_shape).astype(np.int32), device="cpu0") rout = tensor(np.ones(rout_shape).astype(np.int32), device="cpu0")
bias_cpu = ( 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 if bias
else None else None
) )
...@@ -1111,7 +1113,9 @@ def test_region_restricted_conv_forward_backward_uint8(bias): ...@@ -1111,7 +1113,9 @@ def test_region_restricted_conv_forward_backward_uint8(bias):
rin = tensor(np.ones(rin_shape).astype(np.uint8), device=handle) rin = tensor(np.ones(rin_shape).astype(np.uint8), device=handle)
rout = tensor(np.ones(rout_shape).astype(np.uint8), device=handle) rout = tensor(np.ones(rout_shape).astype(np.uint8), device=handle)
bias_gpu = ( 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]) gm = GradManager().attach([src, filter])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册