"csrc/gfx93/vscode:/vscode.git/clone" did not exist on "1dea361d3adb31ff078e2e78ef0bbea7ebc1e010"
Commit 93aa19ee authored by yan.yan's avatar yan.yan
Browse files

fix #399, #400: fix PointToVoxel, fix a small bug

parent ef3db59a
# Changelog
## [2.1.18] - 2021-11-29
### Fixed
- Fix a small bug of spatial_shape.
- Fix a bug in PointToVoxel, we must always return a clone instead of a view.
## [2.1.17] - 2021-11-29
### Fixed
- Fix a bug in sparse add.
......
......@@ -48,7 +48,7 @@
Check [spconv 2.x algorithm introduction](docs/spconv2_algo.pdf) to understand sparse convolution algorithm in spconv 2.x!
**WARNING** spconv < 2.1.17 users need to upgrade your version to 2.1.17, it fix a bug in conv weight init which cause std of inited weight too large.
**WARNING** spconv < 2.1.18 users need to upgrade your version to 2.1.18, it fix a bug in conv weight init which cause std of inited weight too large, and a bug in PointToVoxel.
## Breaking changes in Spconv 2.x
......
......@@ -124,7 +124,7 @@ class SparseConvTensor(metaclass=SpConvTensorMeta):
def __init__(self,
features: torch.Tensor,
indices: torch.Tensor,
spatial_shape: List[int],
spatial_shape: Union[List[int], np.ndarray],
batch_size: int,
grid: Optional[torch.Tensor] = None,
voxel_num: Optional[torch.Tensor] = None,
......@@ -151,7 +151,7 @@ class SparseConvTensor(metaclass=SpConvTensorMeta):
assert batch_size > 0
self._features = features
self.indices = indices
self.spatial_shape = spatial_shape
self.spatial_shape = [int(v) for v in spatial_shape]
self.batch_size = batch_size
if indice_dict is None:
indice_dict = {}
......@@ -246,12 +246,14 @@ class SparseConvTensor(metaclass=SpConvTensorMeta):
tensor._timer = self._timer
return tensor
def expand_nd(ndim: int, val: Union[int, List[int], Tuple[int, ...]]) -> List[int]:
def expand_nd(ndim: int, val: Union[int, List[int], Tuple[int, ...], np.ndarray]) -> List[int]:
if isinstance(val, int):
res = [val] * ndim
elif isinstance(val, tuple):
res = list(val)
elif isinstance(val, np.ndarray):
res = list(val)
else:
res = val
assert len(res) == ndim
return res
return [int(v) for v in res]
......@@ -153,8 +153,8 @@ class PointToVoxel(object):
clear_voxels)
num_voxels = res[0].shape[0]
return (self.voxels[:num_voxels], self.indices[:num_voxels],
self.num_per_voxel[:num_voxels], pc_voxel_id)
return (self.voxels[:num_voxels].clone(), self.indices[:num_voxels].clone(),
self.num_per_voxel[:num_voxels].clone(), pc_voxel_id)
def gather_features_by_pc_voxel_id(seg_res_features: torch.Tensor, pc_voxel_id: torch.Tensor, invalid_value: Union[int, float] = 0):
......
2.1.17
\ No newline at end of file
2.1.18
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment