点此进入CSDN

点此添加QQ好友 加载失败时会显示




摘要: 实验代码 import torch import torch.nn as nn #y = wx + b class MyModel(nn.Module): def __init__(self): super(MyModel,self).__init__() #自定义代码 # self.w = tor 阅读全文
posted @ 2020-02-12 19:34 高颜值的殺生丸 阅读(525) 评论(0) 推荐(0) 编辑
摘要: import torch import matplotlib.pyplot as plt learning_rate = 0.1 #准备数据 #y = 3x +0.8 x = torch.randn([500,1]) y_true = 3*x + 0.8 #计算预测值 w = torch.rand( 阅读全文
posted @ 2020-02-12 17:37 高颜值的殺生丸 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 前项计算1 import torch # (3*(x+2)^2)/4 #grad_fn 保留计算的过程 x = torch.ones([2,2],requires_grad=True) print(x) y = x+2 print(y) z = 3*y.pow(2) print(z) out = z 阅读全文
posted @ 2020-02-12 16:56 高颜值的殺生丸 阅读(513) 评论(0) 推荐(0) 编辑
摘要: import torch import numpy as np device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") x = torch.tensor(np.arange(15).reshape(3,5)) i 阅读全文
posted @ 2020-02-12 16:11 高颜值的殺生丸 阅读(1456) 评论(0) 推荐(0) 编辑

作者信息

昵称:

刘新宇

园龄:4年6个月


粉丝:1209


QQ:522414928