pytorch机器学习
qq_41568035
这个作者很懒,什么都没留下…
展开
-
用pytorch实现神经网络线性回归
用pytorch实现神经网络线性回归 import torch import matplotlib.pyplot as plt from torch import nn, optim from time import perf_counter x = torch.unsqueeze(torch.linspace(-3, 3, 10000), dim=1) y = x + 1.2 * torch.rand(x.size()) class LR(nn.Module): def __init__(se原创 2021-04-30 16:56:24 · 378 阅读 · 1 评论 -
用pytorch实现大规模数据线性回归
用pytorch实现大规模数据线性回归 import torch import matplotlib.pyplot as plt def Produce_X(x): x0 = torch.ones(x.numpy().size) X = torch.stack((x,x0),dim=1) return X x = torch.linspace(-3, 3, 100000) X = Produce_X(x) y = x + 1.2*torch.rand(x.size()) w原创 2021-04-30 16:47:05 · 202 阅读 · 1 评论 -
用pytorch实现线性回归
用pytorch实现线性回归 import torch import matplotlib.pyplot as plt def Produce_X(x): x0 = torch.ones(x.numpy().size) X = torch.stack((x, x0), dim=1) return X x = torch.Tensor([1.4, 5, 11, 16, 21]) y = torch.Tensor([14.4, 29.6, 62, 85.5, 113.4]) X原创 2021-04-30 16:44:53 · 86 阅读 · 1 评论