Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
MMCV
Commits
3a49ee35
Commit
3a49ee35
authored
Nov 11, 2022
by
xiabo
Browse files
测试用例修改
parent
32fec198
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
tests/test_ops/test_deform_conv.py
tests/test_ops/test_deform_conv.py
+21
-4
No files found.
tests/test_ops/test_deform_conv.py
View file @
3a49ee35
...
...
@@ -76,8 +76,16 @@ class TestDeformconv:
assert
np
.
allclose
(
out
.
data
.
detach
().
cpu
().
numpy
(),
repeated_gt_out
,
threshold
)
assert
np
.
allclose
(
x
.
grad
.
detach
().
cpu
().
numpy
(),
repeated_gt_x_grad
,
threshold
)
cpu_data
=
x
.
grad
.
detach
().
cpu
().
numpy
()
for
i
in
range
(
10
):
for
j
in
range
(
3
):
for
k
in
range
(
3
):
if
((
abs
(
cpu_data
[
i
][
0
][
j
][
k
]
-
repeated_gt_x_grad
[
i
][
0
][
j
][
k
]))
>
threshold
):
print
(
"====error===="
,
cpu_data
[
i
][
0
][
j
][
k
],
repeated_gt_x_grad
[
i
][
0
][
j
][
k
])
assert
(
0
)
#assert np.allclose(x.grad.detach().cpu().numpy(), repeated_gt_x_grad,
# threshold)
# the batch size of the input is increased which results in
# a larger gradient so we need to divide by the batch_size
assert
np
.
allclose
(
...
...
@@ -150,8 +158,17 @@ class TestDeformconv:
assert
np
.
allclose
(
out
.
data
.
detach
().
cpu
().
numpy
(),
repeated_gt_out
,
threshold
)
assert
np
.
allclose
(
x
.
grad
.
detach
().
cpu
().
numpy
(),
repeated_gt_x_grad
,
threshold
)
cpu_data
=
x
.
grad
.
detach
().
cpu
().
numpy
()
for
i
in
range
(
10
):
for
j
in
range
(
3
):
for
k
in
range
(
3
):
if
((
abs
(
cpu_data
[
i
][
0
][
j
][
k
]
-
repeated_gt_x_grad
[
i
][
0
][
j
][
k
]))
>
threshold
):
print
(
"====error===="
,
cpu_data
[
i
][
0
][
j
][
k
],
repeated_gt_x_grad
[
i
][
0
][
j
][
k
])
assert
(
0
)
#assert np.allclose(x.grad.detach().cpu().numpy(), repeated_gt_x_grad,
# threshold)
assert
np
.
allclose
(
model
.
conv_offset
.
weight
.
grad
.
detach
().
cpu
().
numpy
()
/
batch_size
,
gt_offset_weight_grad
,
threshold
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment