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
ce58fd6f
Unverified
Commit
ce58fd6f
authored
Oct 20, 2021
by
Shilong Zhang
Committed by
GitHub
Oct 20, 2021
Browse files
add device DeviceGuard (#1402)
parent
c5018463
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
mmcv/ops/csrc/pytorch/ms_deform_attn.cpp
mmcv/ops/csrc/pytorch/ms_deform_attn.cpp
+2
-0
No files found.
mmcv/ops/csrc/pytorch/ms_deform_attn.cpp
View file @
ce58fd6f
...
...
@@ -39,6 +39,7 @@ Tensor ms_deform_attn_forward(const Tensor &value, const Tensor &spatial_shapes,
CHECK_CUDA_INPUT
(
level_start_index
)
CHECK_CUDA_INPUT
(
sampling_loc
)
CHECK_CUDA_INPUT
(
attn_weight
)
at
::
DeviceGuard
guard
(
value
.
device
());
return
ms_deform_attn_cuda_forward
(
value
,
spatial_shapes
,
level_start_index
,
sampling_loc
,
attn_weight
,
im2col_step
);
#else
...
...
@@ -66,6 +67,7 @@ void ms_deform_attn_backward(const Tensor &value, const Tensor &spatial_shapes,
CHECK_CUDA_INPUT
(
grad_value
)
CHECK_CUDA_INPUT
(
grad_sampling_loc
)
CHECK_CUDA_INPUT
(
grad_attn_weight
)
at
::
DeviceGuard
guard
(
value
.
device
());
ms_deform_attn_cuda_backward
(
value
,
spatial_shapes
,
level_start_index
,
sampling_loc
,
attn_weight
,
grad_output
,
grad_value
,
grad_sampling_loc
,
...
...
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