【动手深度学习】线性神经网络
线性回归从零开始实现
import random
import torch
from d2l import torch as d2l
# 生成数据集
def synthetic_data(w, b, num_examples):
"""y = Xw + b + noise"""
X = torch.normal(0, 1, (num_examples, len(w)))
y = torch.matmul(X, w) + b
y += torch.normal(0, 0.01
原创
2021-09-27 17:03:24 ·
286 阅读 ·
0 评论