title: pytorch 0.4迁移
date: 2018-07-29 15:11:09
tags:
type()
1 | 本来是 type() |
Tensor(1, requires_grad=True)
1 | w = torch.ones(1, requires_grad=True) |
.data 和 .detach()使用
推荐使用.detach()
0.3.0里面sum区别
tensor.sum()
would return a Python number, butvariable.sum()
would return a vector of size(1,)
.
弃用volatile, 使用torch.no_grad()
1 | with torch.no_grad(): |
