《动手学深度学习》https://github.com/d2l-ai/d2l-zh
· 使用conda/miniconda环境
conda env remove d2l-zh
conda create -n -y d2l-zh python=3.8 pip
conda activate d2l-zh
· 安装需要的包
pip install -y jupyter d2l torch torchvision
pip install jupyter d2l torch torchvision -i https://pypi.tuna.tsinghua.edu.cn/simple使用上面这个命令行可以极大程度的提高下载速度
· 下载代码并执行
wget https://zh-v2.d2l.ai/d2l-zh.zip
unzip d2l-zh.zip
jupyter notebook
DIVE INTO DEEP LEARNINGhttps://zh.d2l.ai/chapter_installation/index.html
0一个标量
1一个特征向量
2一个样本-特征矩阵
3RGB图片(widthxheightxchannel)
4RGB图片批量(batch x width x height x channel)
5视频批量(batch x time x width x height x channel)
形状、数据类型、元素的值
import torchx = torch.arange(12) xx.shapex.numel()X = x.reshape(3, 4) Xtorch.zeros((2, 3, 4))torch.ones((2, 3, 4))torch.randn(3, 4)torch.tensor([[2, 1, 4, 3], [1, 2, 3, 4], [4, 3, 2, 1]])