Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
one
spconv
Commits
70067da8
Commit
70067da8
authored
Aug 25, 2022
by
yan.yan
Browse files
small changes
parent
0c07559f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
5 deletions
+22
-5
spconv/core_cc/csrc/sparse/convops/spops.pyi
spconv/core_cc/csrc/sparse/convops/spops.pyi
+1
-1
spconv/csrc/sparse/convops.py
spconv/csrc/sparse/convops.py
+2
-2
spconv/pytorch/conv.py
spconv/pytorch/conv.py
+6
-0
spconv/pytorch/ops.py
spconv/pytorch/ops.py
+2
-2
spconv/pytorch/pool.py
spconv/pytorch/pool.py
+11
-0
No files found.
spconv/core_cc/csrc/sparse/convops/spops.pyi
View file @
70067da8
...
@@ -56,7 +56,7 @@ class ConvGemmOps:
...
@@ -56,7 +56,7 @@ class ConvGemmOps:
"""
"""
...
...
@staticmethod
@staticmethod
def implicit_gemm(allocator, conv_tuner, features: Tensor, filters: Tensor, pair_fwd: Tensor, pair_mask_fwd_splits: List[Tensor], mask_argsort_fwd_splits: List[Tensor], num_activate_out: int, masks: Tensor, arch: Tuple[int, int], is_train: bool = False, is_subm: bool = False, stream_int: int = 0, timer: CUDAKernelTimer = CUDAKernelTimer(False), auto_fp32_accum: bool = True, fp32_accum: bool = False) ->
int
:
def implicit_gemm(allocator, conv_tuner, features: Tensor, filters: Tensor, pair_fwd: Tensor, pair_mask_fwd_splits: List[Tensor], mask_argsort_fwd_splits: List[Tensor], num_activate_out: int, masks: Tensor, arch: Tuple[int, int], is_train: bool = False, is_subm: bool = False, stream_int: int = 0, timer: CUDAKernelTimer = CUDAKernelTimer(False), auto_fp32_accum: bool = True, fp32_accum: bool = False) ->
Tuple[int, Any]
:
"""
"""
Args:
Args:
allocator:
allocator:
...
...
spconv/csrc/sparse/convops.py
View file @
70067da8
...
@@ -2013,9 +2013,9 @@ class ConvGemmOps(pccm.ParameterizedClass):
...
@@ -2013,9 +2013,9 @@ class ConvGemmOps(pccm.ParameterizedClass):
// tv::ssprint(tune_res.algo_desp.__repr__(), "WTF", exists,
// tv::ssprint(tune_res.algo_desp.__repr__(), "WTF", exists,
// features.shape(), filters.shape(), out_features.shape(), tv::CUDAEvent::sync_and_duration(start_ev, end_ev));
// features.shape(), filters.shape(), out_features.shape(), tv::CUDAEvent::sync_and_duration(start_ev, end_ev));
return
mask_width
;
return
std::make_tuple(mask_width, tune_res)
;
"""
)
"""
)
return
code
.
ret
(
"
int
"
)
return
code
.
ret
(
"
std::tuple<int, ConvTuneResult>
"
)
@
pccm
.
pybind
.
mark
@
pccm
.
pybind
.
mark
@
pccm
.
static_function
@
pccm
.
static_function
...
...
spconv/pytorch/conv.py
View file @
70067da8
...
@@ -136,6 +136,12 @@ class SparseConvolution(SparseModule):
...
@@ -136,6 +136,12 @@ class SparseConvolution(SparseModule):
self
.
_register_load_state_dict_pre_hook
(
self
.
_register_load_state_dict_pre_hook
(
self
.
_load_weight_different_layout
)
self
.
_load_weight_different_layout
)
def
get_max_num_voxels
(
self
)
->
Optional
[
torch
.
Tensor
]:
if
hasattr
(
self
,
_MAX_NUM_VOXELS_DURING_TRAINING
):
return
getattr
(
self
,
_MAX_NUM_VOXELS_DURING_TRAINING
)
return
None
def
_load_weight_different_layout
(
self
,
state_dict
,
prefix
,
local_metadata
,
def
_load_weight_different_layout
(
self
,
state_dict
,
prefix
,
local_metadata
,
strict
,
missing_keys
,
unexpected_keys
,
strict
,
missing_keys
,
unexpected_keys
,
error_msgs
):
error_msgs
):
...
...
spconv/pytorch/ops.py
View file @
70067da8
...
@@ -1366,7 +1366,7 @@ def implicit_gemm(features: torch.Tensor,
...
@@ -1366,7 +1366,7 @@ def implicit_gemm(features: torch.Tensor,
fp32_accum
=
False
fp32_accum
=
False
arch
=
get_arch
()
arch
=
get_arch
()
mask_width
=
ConvGemmOps
.
implicit_gemm
(
mask_width
,
tune_res_cpp
=
ConvGemmOps
.
implicit_gemm
(
alloc
,
CONV_CPP
,
features_tv
,
filters_tv
,
pair_fwd_tv
,
alloc
,
CONV_CPP
,
features_tv
,
filters_tv
,
pair_fwd_tv
,
pair_mask_fwd_splits_tv
,
mask_argsort_fwd_splits_tv
,
pair_mask_fwd_splits_tv
,
mask_argsort_fwd_splits_tv
,
num_activate_out
,
mask_tv
,
arch
,
is_train
,
is_subm
,
stream
,
timer_cpp
,
num_activate_out
,
mask_tv
,
arch
,
is_train
,
is_subm
,
stream
,
timer_cpp
,
...
@@ -1460,7 +1460,7 @@ def implicit_gemm(features: torch.Tensor,
...
@@ -1460,7 +1460,7 @@ def implicit_gemm(features: torch.Tensor,
# CONV.stream_synchronize(stream)
# CONV.stream_synchronize(stream)
# t = time.time()
# t = time.time()
print
(
tune_res
.
algo_desp
,
"REF"
,
features_tv
.
shape
,
filters
.
shape
)
#
print(tune_res.algo_desp, "REF", features_tv.shape, filters.shape)
# with tv.measure_and_print("f16 time"):
# with tv.measure_and_print("f16 time"):
with
timer
.
record
(
"implicit_gemm"
,
stream
):
with
timer
.
record
(
"implicit_gemm"
,
stream
):
for
j
in
range
(
num_split
):
for
j
in
range
(
num_split
):
...
...
spconv/pytorch/pool.py
View file @
70067da8
...
@@ -90,6 +90,12 @@ class SparseMaxPool(SparseModule):
...
@@ -90,6 +90,12 @@ class SparseMaxPool(SparseModule):
s
+=
f
', algo=
{
self
.
algo
}
'
s
+=
f
', algo=
{
self
.
algo
}
'
return
s
.
format
(
**
self
.
__dict__
)
return
s
.
format
(
**
self
.
__dict__
)
def
get_max_num_voxels
(
self
)
->
Optional
[
torch
.
Tensor
]:
if
hasattr
(
self
,
_MAX_NUM_VOXELS_DURING_TRAINING
):
return
getattr
(
self
,
_MAX_NUM_VOXELS_DURING_TRAINING
)
return
None
def
forward
(
self
,
input
):
def
forward
(
self
,
input
):
assert
isinstance
(
input
,
spconv
.
SparseConvTensor
)
assert
isinstance
(
input
,
spconv
.
SparseConvTensor
)
features
=
input
.
features
features
=
input
.
features
...
@@ -283,6 +289,11 @@ class SparseAvgPool(SparseModule):
...
@@ -283,6 +289,11 @@ class SparseAvgPool(SparseModule):
s
+=
f
', algo=
{
self
.
algo
}
'
s
+=
f
', algo=
{
self
.
algo
}
'
return
s
.
format
(
**
self
.
__dict__
)
return
s
.
format
(
**
self
.
__dict__
)
def
get_max_num_voxels
(
self
)
->
Optional
[
torch
.
Tensor
]:
if
hasattr
(
self
,
_MAX_NUM_VOXELS_DURING_TRAINING
):
return
getattr
(
self
,
_MAX_NUM_VOXELS_DURING_TRAINING
)
return
None
def
forward
(
self
,
input
):
def
forward
(
self
,
input
):
assert
isinstance
(
input
,
spconv
.
SparseConvTensor
)
assert
isinstance
(
input
,
spconv
.
SparseConvTensor
)
features
=
input
.
features
features
=
input
.
features
...
...
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