MCPcopy
hub / github.com/facebookresearch/detectron2 / cat

Function cat

detectron2/layers/wrappers.py:38–45  ·  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

36
37
38def cat(tensors: List[torch.Tensor], dim: int = 0):
39 """
40 Efficient version of torch.cat that avoids a copy if there is only a single element in a list
41 """
42 assert isinstance(tensors, (list, tuple))
43 if len(tensors) == 1:
44 return tensors[0]
45 return torch.cat(tensors, dim)
46
47
48def cross_entropy(input, target, *, reduction="mean", **kwargs):

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