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
f7382417
Unverified
Commit
f7382417
authored
Jun 01, 2023
by
duzekun
Committed by
GitHub
Jun 01, 2023
Browse files
[Refactor] Simplify the logic of sparse_conv (#2802)
parent
ba8aa764
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
12 deletions
+4
-12
mmcv/ops/csrc/pytorch/mlu/sparse_conv_mlu.cpp
mmcv/ops/csrc/pytorch/mlu/sparse_conv_mlu.cpp
+4
-12
No files found.
mmcv/ops/csrc/pytorch/mlu/sparse_conv_mlu.cpp
View file @
f7382417
...
...
@@ -147,12 +147,8 @@ torch::Tensor IndiceConvForwardMLUKernelLauncher(
torch
::
Tensor
indiceNum
,
int64_t
numActOut
,
int64_t
_inverse
,
int64_t
_subM
)
{
auto
indice_num_cpu
=
indiceNum
.
to
({
torch
::
kCPU
});
auto
indice_num_cpu_64
=
indice_num_cpu
.
data_ptr
<
int
>
();
int
indice_num_len
=
indiceNum
.
numel
();
int64_t
indice_num
[
indice_num_len
];
for
(
int
i
=
0
;
i
<
indice_num_len
;
++
i
)
{
indice_num
[
i
]
=
(
int64_t
)(((
int
*
)
indice_num_cpu_64
)[
i
]);
}
auto
indice_num_cpu_64
=
indice_num_cpu
.
to
(
torch
::
kInt64
);
auto
indice_num
=
indice_num_cpu_64
.
data_ptr
<
int64_t
>
();
// generate empty output
int
C
=
filters
.
dim
()
==
4
?
filters
.
size
(
3
)
:
filters
.
size
(
4
);
...
...
@@ -241,12 +237,8 @@ std::vector<torch::Tensor> IndiceConvBackwardMLUKernelLauncher(
torch
::
Tensor
indicePairs
,
torch
::
Tensor
indiceNum
,
int64_t
_inverse
,
int64_t
_subM
)
{
auto
indice_num_cpu
=
indiceNum
.
to
({
torch
::
kCPU
});
auto
indice_num_cpu_64
=
indice_num_cpu
.
data_ptr
<
int
>
();
int
indice_num_len
=
indiceNum
.
numel
();
int64_t
indice_num
[
indice_num_len
];
for
(
int
i
=
0
;
i
<
indice_num_len
;
++
i
)
{
indice_num
[
i
]
=
(
int64_t
)(((
int
*
)(
indice_num_cpu_64
))[
i
]);
}
auto
indice_num_cpu_64
=
indice_num_cpu
.
to
(
torch
::
kInt64
);
auto
indice_num
=
indice_num_cpu_64
.
data_ptr
<
int64_t
>
();
// generate empty input_grad
torch
::
Tensor
input_grad
=
at
::
zeros
({
features
.
size
(
0
),
features
.
size
(
1
)},
...
...
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