PyTorch学习笔记(1)张量
tensor torch.tensor(data, # 数据 可以使list numpy dtype=None, # 数据类型 默认与data一致 device=None, # 所在设备 cuda / cpu requires_grad=False, # 是否需要梯度 pin_memory = False ,# 是否存于锁页内存) flag = True if flag: arr = np.ones((3,3)) print('ndarray的数据类型:',arr.dtype) t = torch.tensor(arr,device='cuda') pr
下载地址
用户评论