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
0287324f
Commit
0287324f
authored
Apr 23, 2023
by
xiabo
Browse files
dtk2210.1 torch1.8.0
parent
e45bf20b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
mmcv/ops/saconv.py
mmcv/ops/saconv.py
+3
-2
tests/test_ops/test_ms_deformable_attn.py
tests/test_ops/test_ms_deformable_attn.py
+1
-1
tests/test_ops/test_nms.py
tests/test_ops/test_nms.py
+1
-1
No files found.
mmcv/ops/saconv.py
View file @
0287324f
...
@@ -97,11 +97,12 @@ class SAConv2d(ConvAWS2d):
...
@@ -97,11 +97,12 @@ class SAConv2d(ConvAWS2d):
avg_x
=
F
.
avg_pool2d
(
avg_x
,
kernel_size
=
5
,
stride
=
1
,
padding
=
0
)
avg_x
=
F
.
avg_pool2d
(
avg_x
,
kernel_size
=
5
,
stride
=
1
,
padding
=
0
)
switch
=
self
.
switch
(
avg_x
)
switch
=
self
.
switch
(
avg_x
)
# sac
weight
=
self
.
_get_weight
(
self
.
weight
)
zero_bias
=
torch
.
zeros
(
zero_bias
=
torch
.
zeros
(
self
.
out_channels
,
device
=
weight
.
device
,
dtype
=
weight
.
dtype
)
self
.
out_channels
,
device
=
weight
.
device
,
dtype
=
weight
.
dtype
)
# sac
weight
=
self
.
_get_weight
(
self
.
weight
)
if
self
.
use_deform
:
if
self
.
use_deform
:
offset
=
self
.
offset_s
(
avg_x
)
offset
=
self
.
offset_s
(
avg_x
)
out_s
=
deform_conv2d
(
x
,
offset
,
weight
,
self
.
stride
,
self
.
padding
,
out_s
=
deform_conv2d
(
x
,
offset
,
weight
,
self
.
stride
,
self
.
padding
,
...
...
tests/test_ops/test_ms_deformable_attn.py
View file @
0287324f
...
@@ -92,7 +92,7 @@ def test_forward_equal_with_pytorch_float():
...
@@ -92,7 +92,7 @@ def test_forward_equal_with_pytorch_float():
@
pytest
.
mark
.
skipif
(
@
pytest
.
mark
.
skipif
(
not
torch
.
cuda
.
is_available
(),
reason
=
'requires CUDA support'
)
not
torch
.
cuda
.
is_available
(),
reason
=
'requires CUDA support'
)
@
pytest
.
mark
.
parametrize
(
'channels'
,
[
4
,
30
,
32
,
64
,
71
,
1025
,
2048
,
3096
])
@
pytest
.
mark
.
parametrize
(
'channels'
,
[
4
,
30
,
32
,
64
,
71
,
1025
])
def
test_gradient_numerical
(
channels
,
def
test_gradient_numerical
(
channels
,
grad_value
=
True
,
grad_value
=
True
,
grad_sampling_loc
=
True
,
grad_sampling_loc
=
True
,
...
...
tests/test_ops/test_nms.py
View file @
0287324f
...
@@ -136,7 +136,7 @@ class Testnms(object):
...
@@ -136,7 +136,7 @@ class Testnms(object):
def
test_batched_nms
(
self
):
def
test_batched_nms
(
self
):
import
mmcv
import
mmcv
from
mmcv.ops
import
batched_nms
from
mmcv.ops
import
batched_nms
results
=
mmcv
.
load
(
'./tests/data/batched_nms_data.pkl'
)
results
=
mmcv
.
load
(
'.
.
/tests/data/batched_nms_data.pkl'
)
nms_cfg
=
dict
(
type
=
'nms'
,
iou_threshold
=
0.7
)
nms_cfg
=
dict
(
type
=
'nms'
,
iou_threshold
=
0.7
)
boxes
,
keep
=
batched_nms
(
boxes
,
keep
=
batched_nms
(
...
...
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