maskrcnn-benchmark 代码详解之 modeling/utils.py

匿名 (未验证) 提交于 2019-12-02 23:38:02
 def cat(tensors, dim=0):     """     Efficient version of torch.cat that avoids a copy if there is only a single element in a list     """     """     重写了cat函数,使得当传入的张量只有一个元素的时候避免做拼接操作,只有可拼接的情况下,即有多个元素的情况下进行拼接     """     assert isinstance(tensors, (list, tuple))     if len(tensors) == 1:         return tensors[0]     return torch.cat(tensors, dim)

文章来源: https://blog.csdn.net/leijieZhang/article/details/90909781
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!