Skip to content

Commit

Permalink
new version number
Browse files Browse the repository at this point in the history
  • Loading branch information
FindDefinition committed Mar 23, 2023
1 parent f582ec3 commit f101f97
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 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.
Expand Down
13 changes: 7 additions & 6 deletions docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions spconv/pytorch/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,14 @@ def replace_feature(self, feature: torch.Tensor):
new_spt.int8_scale = self.int8_scale

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)
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.4
2.3.5

0 comments on commit f101f97

Please sign in to comment.