| 288 | return SparseTensor(feats=feats, coords=coords) |
| 289 | |
| 290 | def __merge_sparse_cache(self, other: 'SparseTensor') -> dict: |
| 291 | new_cache = {} |
| 292 | for k in set(list(self._spatial_cache.keys()) + list(other._spatial_cache.keys())): |
| 293 | if k in self._spatial_cache: |
| 294 | new_cache[k] = self._spatial_cache[k] |
| 295 | if k in other._spatial_cache: |
| 296 | if k not in new_cache: |
| 297 | new_cache[k] = other._spatial_cache[k] |
| 298 | else: |
| 299 | new_cache[k].update(other._spatial_cache[k]) |
| 300 | return new_cache |
| 301 | |
| 302 | def __neg__(self) -> 'SparseTensor': |
| 303 | return self.replace(-self.feats) |