MCPcopy
hub / github.com/Mikubill/sd-webui-controlnet / cat

Function cat

annotator/oneformer/detectron2/layers/wrappers.py:50–57  ·  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

48
49
50def cat(tensors: List[torch.Tensor], dim: int = 0):
51 """
52 Efficient version of torch.cat that avoids a copy if there is only a single element in a list
53 """
54 assert isinstance(tensors, (list, tuple))
55 if len(tensors) == 1:
56 return tensors[0]
57 return torch.cat(tensors, dim)
58
59
60def empty_input_loss_func_wrapper(loss_func):

Callers 15

assign_boxes_to_levelsFunction · 0.90
keypoint_rcnn_lossFunction · 0.90
keypoint_rcnn_inferenceFunction · 0.90
lossesMethod · 0.90
predict_boxesMethod · 0.90
mask_rcnn_lossFunction · 0.90
mask_rcnn_inferenceFunction · 0.90
lossesMethod · 0.90
find_top_rpn_proposalsFunction · 0.90

Calls 1

catMethod · 0.45

Tested by

no test coverage detected