MCPcopy Create free account
hub / github.com/TencentARC/Pixal3D / layout_from_seqlen

Method layout_from_seqlen

pixal3d/modules/sparse/basic.py:31–40  ·  view source on GitHub ↗

Create a layout from a tensor of sequence lengths.

(seqlen: list)

Source from the content-addressed store, hash-verified

29
30 @staticmethod
31 def layout_from_seqlen(seqlen: list) -> List[slice]:
32 """
33 Create a layout from a tensor of sequence lengths.
34 """
35 layout = []
36 start = 0
37 for l in seqlen:
38 layout.append(slice(start, start + l))
39 start += l
40 return layout
41
42 @staticmethod
43 def from_tensor_list(tensor_list: List[torch.Tensor]) -> 'VarLenTensor':

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected