03 2020 档案

摘要:之前一直不清楚怎么查看模型的参数和结构,现在学习了一下。 首先搞个resnet20出来 import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import init from models.r 阅读全文
posted @ 2020-03-28 00:28 嶙羽 阅读(14213) 评论(0) 推荐(0) 编辑
摘要:Pytorch中根据索引取张量有很多方法,比如index_select和masked_select,和gt,ge等配合食用,但如果需要取出最小几个或最大几个张量的索引,则需要动手写一下 a = torch.tensor([2,3,1,5]) y,_ = torch.sort(a) mask = a. 阅读全文
posted @ 2020-03-24 20:48 嶙羽 阅读(6603) 评论(0) 推荐(0) 编辑
摘要:1、主要作用:变换tensor维度 example: import torch x = torch.randn(2, 3, 5) print(x.size()) print(x.permute(2, 0, 1).size()) >>>torch.Size([2, 3, 5]) >>>torch.Si 阅读全文
posted @ 2020-03-10 23:01 嶙羽 阅读(5092) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示