(aabb, dim, value, dtype=torch.float32, device=None)
| 275 | |
| 276 | @staticmethod |
| 277 | def full(aabb, dim, value, dtype=torch.float32, device=None) -> 'SparseTensor': |
| 278 | N, C = dim |
| 279 | x = torch.arange(aabb[0], aabb[3] + 1) |
| 280 | y = torch.arange(aabb[1], aabb[4] + 1) |
| 281 | z = torch.arange(aabb[2], aabb[5] + 1) |
| 282 | coords = torch.stack(torch.meshgrid(x, y, z, indexing='ij'), dim=-1).reshape(-1, 3) |
| 283 | coords = torch.cat([ |
| 284 | torch.arange(N).view(-1, 1).repeat(1, coords.shape[0]).view(-1, 1), |
| 285 | coords.repeat(N, 1), |
| 286 | ], dim=1).to(dtype=torch.int32, device=device) |
| 287 | feats = torch.full((coords.shape[0], C), value, dtype=dtype, device=device) |
| 288 | return SparseTensor(feats=feats, coords=coords) |
| 289 | |
| 290 | def __merge_sparse_cache(self, other: 'SparseTensor') -> dict: |
| 291 | new_cache = {} |
no test coverage detected