MCPcopy Index your code
hub / github.com/TencentARC/Pixal3D / from_tensor_list

Method from_tensor_list

pixal3d/modules/sparse/basic.py:435–445  ·  view source on GitHub ↗

Create a SparseTensor from a list of tensors.

(feats_list: List[torch.Tensor], coords_list: List[torch.Tensor])

Source from the content-addressed store, hash-verified

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 """

Callers

nothing calls this directly

Calls 1

SparseTensorClass · 0.85

Tested by

no test coverage detected