MCPcopy Create free account
hub / github.com/microsoft/TRELLIS.2 / from_tensor_list

Method from_tensor_list

trellis2/modules/sparse/basic.py:43–53  ·  view source on GitHub ↗

Create a VarLenTensor from a list of tensors.

(tensor_list: List[torch.Tensor])

Source from the content-addressed store, hash-verified

41
42 @staticmethod
43 def from_tensor_list(tensor_list: List[torch.Tensor]) -> 'VarLenTensor':
44 """
45 Create a VarLenTensor from a list of tensors.
46 """
47 feats = torch.cat(tensor_list, dim=0)
48 layout = []
49 start = 0
50 for tensor in tensor_list:
51 layout.append(slice(start, start + tensor.shape[0]))
52 start += tensor.shape[0]
53 return VarLenTensor(feats, layout)
54
55 def to_tensor_list(self) -> List[torch.Tensor]:
56 """

Callers 1

forwardMethod · 0.45

Calls 1

VarLenTensorClass · 0.85

Tested by

no test coverage detected