摘要:        
实验代码 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
高颜值的殺生丸
阅读(568)
评论(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
高颜值的殺生丸
阅读(248)
评论(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
高颜值的殺生丸
阅读(524)
评论(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
高颜值的殺生丸
阅读(1488)
评论(0)
推荐(0)
        

浙公网安备 33010602011771号