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

Function sparse_unbind

trellis2/modules/sparse/basic.py:824–836  ·  view source on GitHub ↗

Unbind a sparse tensor along a dimension. Args: input (SparseTensor): Sparse tensor to unbind. dim (int): Dimension to unbind.

(input: SparseTensor, dim: int)

Source from the content-addressed store, hash-verified

822
823
824def sparse_unbind(input: SparseTensor, dim: int) -> List[SparseTensor]:
825 """
826 Unbind a sparse tensor along a dimension.
827
828 Args:
829 input (SparseTensor): Sparse tensor to unbind.
830 dim (int): Dimension to unbind.
831 """
832 if dim == 0:
833 return [input[i] for i in range(input.shape[0])]
834 else:
835 feats = input.feats.unbind(dim)
836 return [input.replace(f) for f in feats]

Callers 1

unbindMethod · 0.85

Calls 2

unbindMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected