- 博客(4)
- 收藏
- 关注
原创 李沐动手学深度学习:线性回归
#!pip install matplotlib#!pip install -U d2l%matplotlib inlineimport randomimport torchfrom d2l import torch as d2l#根据带有真实噪声的线性模型构造一个人造数据集 使用线性模型参数w=[2,-3.4]T,b=4.2#和噪声项ε生成数据集及其标签: y=Xw+b+εdef synthetic_data(w,b,num_examples): """生成y=Xw+b+...
2021-10-05 18:28:30
644
原创 李沐动手学深度学习:自动求导
import torch#假设对y=2XΤX(转置) 关于列向量x求导x=torch.arange(4.0)#在计算之前 需要一个地方存储梯度x.requires_grad_(True) #等价于 x=torch.arange(4.0,requires_grad=True)x.grad#计算yy=2*torch.dot(x,x)y#通过调用反向梯度函数计算y关于x每个分量的梯度y.backward()x.grad#验证x.grad==4*x#计算x的另一...
2021-10-04 18:35:34
544
原创 李沐动手学深度学习:数据预处理
import osos.makedirs(os.path.join('.','data'),exist_ok=True)data_file=os.path.join('.','data','house_tiny.csv')with open(data_file,'w') as f: f.write('NumRooms,Alley,Price\n') #列名 f.write('NA,Pave,127500\n') #每行表示一个数据样本 f.write('2,NA...
2021-10-03 21:00:05
195
原创 深度学习第一课:ubuntu20.04安装anaconda3-5.2.0-Linux-x86_64.sh pytorch1.7.1 jupyter和opencv(Typora复制粘贴)
官网下载Anaconda3-5.2.0-Linux-x86_64.sh到本地(Xshell直接拖动)bash Anaconda3-5.2.0-Linux-x86_64.sh (yes...)ubuntu换源(先备份)(可能用sudo)cp /etc/apt/sources.list /etc/apt/sources.list.bakchmod 777 /etc/apt/sources.listvim /etc/apt/sources.list#添加阿里源deb http://mi
2021-10-03 20:43:59
245
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人