PyTorch
whyume
这个作者很懒,什么都没留下…
展开
-
pytorch:网络定义参数的时候后面不能加".cuda()"
pytorch定义网络init()的时候,参数不能加“cuda()”, 不然参数不包含在state_dict()中,比如下面这种写法是错误的 self.W1 = nn.Parameter(torch.FloatTensor(3,3), requires_grad=True).cuda() 应该去掉”.cuda()” self.W1 = nn.Parameter(torch.Float...原创 2018-08-09 21:06:18 · 5311 阅读 · 1 评论 -
pytorch 需要定义多个网络模块
self.fc_list = nn.ModuleList([nn.Linear(output_channel, 1) for i in range(self.num_rels)]) 参考文献: https://discuss.pytorch.org/t/when-should-i-use-nn-modulelist-and-when-should-i-use-nn-sequential/546...原创 2018-09-05 11:00:17 · 4772 阅读 · 0 评论