| 677 | return new_tensor |
| 678 | |
| 679 | def to_dense(self) -> torch.Tensor: |
| 680 | if config.CONV == 'torchsparse': |
| 681 | return self.data.dense() |
| 682 | elif config.CONV == 'spconv': |
| 683 | return self.data.dense() |
| 684 | else: |
| 685 | spatial_shape = self.spatial_shape |
| 686 | ret = torch.zeros(*self.shape, *spatial_shape, dtype=self.dtype, device=self.device) |
| 687 | idx = [self.coords[:, 0], slice(None)] + self.coords[:, 1:].unbind(1) |
| 688 | ret[tuple(idx)] = self.feats |
| 689 | return ret |
| 690 | |
| 691 | @staticmethod |
| 692 | def full(aabb, dim, value, dtype=torch.float32, device=None) -> 'SparseTensor': |