随笔分类 -  《动手学深度学习 Pytorch版》学习笔记

摘要:层: 接收一组输入 生成相应输出 由一组可调整参数描述 块: 可以描述单个层、由多个层组成的组件或整个模型本身 讨论“比单个层大”但是“比整个模型小”的组件“块”更有价值 从编程的角度看,块由类表示 块必须具有反向传播函数 # 以前章多层感知机的代码为例 import torch from torc 阅读全文
posted @ 2023-09-10 07:55 AncilunKiang 阅读(143) 评论(0) 推荐(0) 编辑
摘要:# 4.10.1 下载和缓存数据集 ```python import hashlib import os import tarfile import zipfile import requests #@save DATA_HUB = dict() DATA_URL = 'http://d2l-dat 阅读全文
posted @ 2023-09-06 09:40 AncilunKiang 阅读(168) 评论(0) 推荐(0) 编辑
摘要:# 4.9.1 分布偏移的类型 整节理论,详见书本。 # 4.9.2 分布偏移示例 整节理论,详见书本。 # 4.9.3 分布偏移纠正 整节理论,详见书本。 # 4.9.4 学习问题的分类法 整节理论,详见书本。 # 4.9.5 机器学习中的公平、责任和透明度 整节理论,详见书本。 # 练习 (1) 阅读全文
posted @ 2023-09-06 09:37 AncilunKiang 阅读(60) 评论(0) 推荐(0) 编辑
摘要:# 4.8.1 梯度消失和梯度爆炸 整节理论,详见书本。 1. 梯度消失 ```python %matplotlib inline import torch from d2l import torch as d2l x = torch.arange(-8.0, 8.0, 0.1, requires_ 阅读全文
posted @ 2023-09-06 09:36 AncilunKiang 阅读(70) 评论(0) 推荐(0) 编辑
摘要:# 4.7.1 前向传播 整节理论,详见书本。 # 4.7.2 前向传播计算图 整节理论,详见书本。 # 4.7.3 反向传播 整节理论,详见书本。 # 4.7.4 训练神经网络 整节理论,详见书本。 # 练习 (1)假设一些标量函数 X 的输入 Xn×m 矩阵。f 阅读全文
posted @ 2023-09-06 09:33 AncilunKiang 阅读(114) 评论(0) 推荐(0) 编辑
摘要:```python import torch from torch import nn from d2l import torch as d2l ``` # 4.6.1 重新审视过拟合 整节理论,详见书本。 # 4.6.2 扰动的稳健性 整节理论,详见书本。 # 4.6.3 实践中的暂退法 整节理论 阅读全文
posted @ 2023-09-06 09:29 AncilunKiang 阅读(133) 评论(0) 推荐(0) 编辑
摘要:# 4.5.1 范数与权重衰减 整节理论,详见书本。 # 4.5.2 高维线性回归 ```python %matplotlib inline import torch from torch import nn from d2l import torch as d2l ``` ```python # 阅读全文
posted @ 2023-09-06 09:25 AncilunKiang 阅读(119) 评论(0) 推荐(0) 编辑
摘要:# 4.4.1 训练误差和泛化误差 整节理论,详见书本。 # 4.4.2 模型选择 整节理论,详见书本。 # 4.4.3 欠拟合还是过拟合 整节理论,详见书本。 # 4.4.4 多项回归 ```python import math import numpy as np import torch fr 阅读全文
posted @ 2023-09-01 19:51 AncilunKiang 阅读(157) 评论(0) 推荐(1) 编辑
摘要:```python import torch from torch import nn from d2l import torch as d2l ``` # 模型 ```python net = nn.Sequential(nn.Flatten(), nn.Linear(784, 256), nn. 阅读全文
posted @ 2023-09-01 19:49 AncilunKiang 阅读(142) 评论(0) 推荐(1) 编辑
摘要:```python import torch from torch import nn from d2l import torch as d2l # 经典数据集与batch size batch_size = 256 train_iter, test_iter = d2l.load_data_fas 阅读全文
posted @ 2023-08-31 11:59 AncilunKiang 阅读(273) 评论(0) 推荐(0) 编辑
摘要:```python %matplotlib inline import torch from d2l import torch as d2l ``` # 4.1.1 隐藏层 整节理论,详见书本。 以下展示常见的激活函数。 1. ReLU 函数 $$ \mathrm{ReLU}(x)=\max(x,0 阅读全文
posted @ 2023-08-30 21:39 AncilunKiang 阅读(81) 评论(0) 推荐(0) 编辑
摘要:```python import torch from torch import nn from d2l import torch as d2l batch_size = 256 # 保持批量大小为 256 train_iter, test_iter = d2l.load_data_fashion_ 阅读全文
posted @ 2023-05-28 15:44 AncilunKiang 阅读(171) 评论(0) 推荐(0) 编辑
摘要:```python import torch from IPython import display from d2l import torch as d2l batch_size = 256 # batch_size 设为256 train_iter, test_iter = d2l.load_d 阅读全文
posted @ 2023-05-28 15:42 AncilunKiang 阅读(295) 评论(0) 推荐(0) 编辑
摘要:```python %matplotlib inline import torch import torchvision from torch.utils import data from torchvision import transforms from d2l import torch as 阅读全文
posted @ 2023-05-28 15:41 AncilunKiang 阅读(68) 评论(0) 推荐(0) 编辑
摘要:# 3.4.1 分类问题 整节理论知识,详见书本。 # 3.4.2 网络架构 整节理论知识,详见书本。 # 3.4.3 全连接层的参数开销 整节理论知识,详见书本。 # 3.4.4 softmax运算 整节理论知识,详见书本。 # 3.4.5 小批量样本的向量化 整节理论知识,详见书本。 # 3.4 阅读全文
posted @ 2023-05-27 13:43 AncilunKiang 阅读(156) 评论(0) 推荐(0) 编辑
摘要:```python import numpy as np import torch from torch.utils import data from d2l import torch as d2l from torch import nn # nn 是神经网络(Neural Networks)的缩 阅读全文
posted @ 2023-05-27 13:42 AncilunKiang 阅读(302) 评论(0) 推荐(0) 编辑
摘要:```python %matplotlib inline import random import torch from d2l import torch as d2l ``` # 3.2.1 生成数据集 为了简单起见,使用易于可视化的低维数据。使用线性模型 $\boldsymbol{y}=\bol 阅读全文
posted @ 2023-05-26 11:47 AncilunKiang 阅读(341) 评论(0) 推荐(0) 编辑
摘要:# 3.1.1 线性回归的基本元素 整节理论知识,详见书本。 # 3.1.2 向量加速化 ```python %matplotlib inline import math import time import numpy as np import torch from d2l import torc 阅读全文
posted @ 2023-05-26 11:45 AncilunKiang 阅读(109) 评论(0) 推荐(0) 编辑
摘要:# 2.7.1 查找模块中的所有函数和类 ```python import torch ``` 可以调用 dir 函数查询函数中有哪些模块和类。 以 “__”(双下划线) 开始和结束的函数是 Python 中的特殊对象,以 “_”(单下划线)开始的函数是内部函数,通常以上两种函数可以忽略。 ```p 阅读全文
posted @ 2023-05-25 17:20 AncilunKiang 阅读(68) 评论(0) 推荐(0) 编辑
摘要:# 2.6.1 基本概率论 ```python %matplotlib inline import torch from torch.distributions import multinomial from d2l import torch as d2l ``` 先说几个统计学中的名词: - 抽样 阅读全文
posted @ 2023-05-25 17:18 AncilunKiang 阅读(389) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示