Commit f101f97e authored by yan.yan's avatar yan.yan
Browse files

new version number

parent f582ec34
# Changelog
## [2.3.5] - 2023-03-24
### Fixed
- pypi project reach size limit, so we need to assign a new version number.
## [2.3.4] - 2023-03-23
### Added
- Add SparseGlobalMaxPool and SparseGlobalAvgPool for training only. libspconv don't support it.
......
......@@ -145,15 +145,16 @@ class ExampleNet(nn.Module):
return self.net(x)
```
### How To Use SparseConvTranspose
### Generative Model Usage
```SparseConvTranspose``` (standard upsampling) should only be used in generative model. You need to use a classifier to check if a output coordicates is empty, then set batch indices (or xyz) of that sparse tensor to a negative number:
```SparseConvTranspose``` (standard upsampling) should only be used in generative model. You need to use a classifier to check if a output coordicates is empty, then set batch indices (or xyz) of that sparse tensor to a negative number.
```Python
spt.indices[empty_mask, 0] = -1
```
1. use ```SparseConvTranspose``` to upsample your sparse conv tensor, this will generate lots of points.
2. use a classifier to get valid indices
3. use ```select_by_index``` to generate new sparse conv tensor
In next sparse convolution, invalid coordinates will be removed until you perform next ```spt.indices[empty_mask, 0] = -1```.
#### Common Mistake
* issue [#467](https://github.com/traveller59/spconv/issues/467)
......
......@@ -212,6 +212,14 @@ class SparseConvTensor(metaclass=SpConvTensorMeta):
return new_spt
def select_by_index(self, valid_indices: torch.Tensor):
new_spt = self.shadow_copy()
new_spt.indices = self.indices[valid_indices]
new_spt.features = self.features[valid_indices]
# reuse data must be cleared after modify indices
new_spt.indice_dict.clear()
return new_spt
def minus(self):
return self.replace_feature(-self.features)
......
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