MCPcopy Index your code
hub / github.com/OpenGVLab/HumanBench / cat

Function cat

PATH/core/models/ops/utils.py:132–139  ·  view source on GitHub ↗

Efficient version of torch.cat that avoids a copy if there is only a single element in a list

(tensors: List[torch.Tensor], dim: int = 0)

Source from the content-addressed store, hash-verified

130
131
132def cat(tensors: List[torch.Tensor], dim: int = 0):
133 """
134 Efficient version of torch.cat that avoids a copy if there is only a single element in a list
135 """
136 assert isinstance(tensors, (list, tuple))
137 if len(tensors) == 1:
138 return tensors[0]
139 return torch.cat(tensors, dim)

Calls 1

catMethod · 0.45

Tested by

no test coverage detected