PyTorch 新版本0.4 1.0 迁移笔记

import torch, torchvision
import torch.nn.functional as F
dtype = torch.float
device = torch.device("cuda:0")

a = torch.tensor([1,2,3.], requires_grad = True)
print(a.type())

b = a.data
c = a.detach()
b.data[0] = 100
print(b)
print(a)
https://pytorch.org/2018/04/22/0_4_0-migration-guide.html


发表于:2018-06-11 14:27:37

原文链接(转载请保留): http://www.multisilicon.com/blog/a21323312.html

友情链接: MICROIC
首页