Create a SparseTensor from a list of tensors.
(feats_list: List[torch.Tensor], coords_list: List[torch.Tensor])
| 433 | |
| 434 | @staticmethod |
| 435 | def from_tensor_list(feats_list: List[torch.Tensor], coords_list: List[torch.Tensor]) -> 'SparseTensor': |
| 436 | """ |
| 437 | Create a SparseTensor from a list of tensors. |
| 438 | """ |
| 439 | feats = torch.cat(feats_list, dim=0) |
| 440 | coords = [] |
| 441 | for i, coord in enumerate(coords_list): |
| 442 | coord = torch.cat([torch.full_like(coord[:, :1], i), coord[:, 1:]], dim=1) |
| 443 | coords.append(coord) |
| 444 | coords = torch.cat(coords, dim=0) |
| 445 | return SparseTensor(feats, coords) |
| 446 | |
| 447 | def to_tensor_list(self) -> Tuple[List[torch.Tensor], List[torch.Tensor]]: |
| 448 | """ |
nothing calls this directly
no test coverage detected