深度学习部分理解
onlyforbest
这个作者很懒,什么都没留下…
展开
-
根据torch.max得到的索引, 获取原数据中的完整信息 (tensor 张量的选取)
图像输出中torch.manual_seed(1)x=torch.rand(5,3,1,512,11)'''从 11 的维度中取出 '''_,location = torch.max(x[...,3],dim=-1)'''x[...,3] shape torch.Size([5, 3, 1, 512]) ''''''目标是 找出 512 最大的位置,并在原来的prediction中取出对应维度'''print(x.shape)print(location.shape)torch.原创 2021-06-09 21:10:17 · 600 阅读 · 0 评论 -
unsqueeze,squeeze,repeat,expand,expand_as应用示例及其详细说明
import torchbox_a=torch.tensor([[1,2,3],[1,2,3]])print(box_a[:, 2:].squeeze(0).shape)print(box_a[:, 2:].shape)原创 2021-05-31 09:38:09 · 927 阅读 · 0 评论 -
torch.where 防止空操作,避免loss 计算出现nan
import torchy=torch.tensor([1,0])x=torch.tensor([[1,2,3],[1,23,4]])print(x[torch.where(y>10)])diff=x[torch.where(x>100)]''' 通过求和 无法解决高维度的空张量 tensor([], size=(0, 3), dtype=torch.int64)'''y=sum(torch.tensor([[[]]]))print(y)''' 可以先取出张量的数据,再通过.原创 2021-04-22 10:14:56 · 690 阅读 · 0 评论 -
torch搭建网络,模块是否可以重复调用?
参考:https://blog.csdn.net/rocking_struggling/article/details/108357089class MyNetk(t.nn.Module): def __init__(self): super(MyNetk,self).__init__() # print("卷积网络") self.conv1 = nn.Sequential( nn.Conv2d( i.原创 2021-04-11 21:09:58 · 1050 阅读 · 2 评论 -
relu 的缺点理解
援引:https://blog.csdn.net/u011754972/article/details/81584719leakyrelu的理解:https://blog.csdn.net/tyhj_sf/article/details/79932893其实relu不发挥作用主要是在relu的输入为负数的情况下,relu前向传播都是0,反向传播也是0,。...原创 2021-01-29 00:18:24 · 495 阅读 · 0 评论 -
AP和MAP
MAP(Mean Average Precision):单个主题的平均准确率是每篇相关文档检索出后的准确率的平均值。主集合的平均准确率(MAP)是每个主题的平均准确率的平均值。 MAP 是反映系统在全部相关文档上性能的单值指标。系统检索出来的相关文档越靠前(rank 越高),MAP就可能越高。如果系统没有返回相关文档,则准确率默认为0。例如:假设有两个主题,主题1有4个相关网页,主题2有5个相关网页。某系统对于主题1检索出4个相关网页,其rank分别为1, 2, 4, 7;对于主题2检索出3个相关网页,其原创 2020-10-28 10:24:04 · 1769 阅读 · 0 评论