09 2023 档案

摘要:7.7.1 从 ResNet 到 DenseNet DenseNet 可以视为 ResNet 的逻辑扩展。 ResNet 将函数展开为 f(x)=x+g(x),即一个简单的线性项和一个复杂的非线性项。 若将 f 拓展成超过两部分,则 阅读全文
posted @ 2023-09-24 07:48 AncilunKiang 阅读(81) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from torch.nn import functional as F from d2l import torch as d2l 7.6.1 函数类 如果把模型看作一个函数,我们设计的更强大的模型则可以看作范围更大的函数。为了使函 阅读全文
posted @ 2023-09-23 08:24 AncilunKiang 阅读(379) 评论(0) 推荐(0) 编辑
摘要:7.5.1 训练深层网络 训练神经网络的实际问题: 数据预处理的方式会对最终结果产生巨大影响。 训练时,多层感知机的中间层变量可能具有更广的变化范围。 更深层的网络很复杂容易过拟合。 批量规范化对小批量的大小有要求,只有批量大小足够大时批量规范化才是有效的。 用 \(\boldsymbol{x}\i 阅读全文
posted @ 2023-09-22 18:51 AncilunKiang 阅读(129) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from torch.nn import functional as F from d2l import torch as d2l 7.4.1 Inception块 GoogLNet 中的基本卷积块叫做 Inception 块(大概 阅读全文
posted @ 2023-09-21 07:50 AncilunKiang 阅读(122) 评论(0) 推荐(0) 编辑
摘要:LeNet、AlexNet和VGG的设计模式都是先用卷积层与汇聚层提取特征,然后用全连接层对特征进行处理。 AlexNet和VGG对LeNet的改进主要在于扩大和加深这两个模块。网络中的网络(NiN)则是在每个像素的通道上分别使用多层感知机。 import torch from torch impo 阅读全文
posted @ 2023-09-20 08:45 AncilunKiang 阅读(125) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from d2l import torch as d2l 7.2.1 VGG 块 AlexNet 没有提供一个通用的模板来指导后续的研究人员设计新的网络,如今研究人员转向了块的角度思考问题。通过使用循环和子程序,可以很容易地在任何现 阅读全文
posted @ 2023-09-19 15:44 AncilunKiang 阅读(153) 评论(0) 推荐(0) 编辑
摘要:7.1.1 学习表征 深度卷积神经网络的突破出现在2012年。突破可归因于以下两个关键因素: 缺少的成分:数据 数据集紧缺的情况在 2010 年前后兴起的大数据浪潮中得到改善。ImageNet 挑战赛中,ImageNet数据集由斯坦福大学教授李飞飞小组的研究人员开发,利用谷歌图像搜索对分类图片进行预 阅读全文
posted @ 2023-09-18 08:23 AncilunKiang 阅读(102) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from d2l import torch as d2l 6.6.1 LeNet LetNet-5 由两个部分组成: - 卷积编码器:由两个卷积核组成。 - 全连接层稠密块:由三个全连接层组成。 模型结构如下流程图(每个卷积块由一个 阅读全文
posted @ 2023-09-17 20:58 AncilunKiang 阅读(166) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from d2l import torch as d2l 6.5.1 最大汇聚和平均汇聚 汇聚层和卷积层类似,区别在于汇聚层不带包含参数,汇聚操作是确定性的,通常计算汇聚窗口中所有元素的最大值或平均值,即最大汇聚和平均汇聚。 def 阅读全文
posted @ 2023-09-17 20:56 AncilunKiang 阅读(149) 评论(0) 推荐(0) 编辑
摘要:import torch from d2l import torch as d2l 6.4.1 多输入通道 简言之,多通道即为单通道之推广,各参数对上即可。 def corr2d_multi_in(X, K): # 先遍历“X”和“K”的第0个维度(通道维度),再把它们加在一起 return sum 阅读全文
posted @ 2023-09-17 20:55 AncilunKiang 阅读(168) 评论(0) 推荐(0) 编辑
摘要:6.3.1 填充 虽然我们用的卷积核较小,每次只会丢失几像素,但是如果应用多层连续的卷积层,累积的像素丢失就会很多。解决此问题的方法为填充。 填充后的输出形状将为 (nhkh+ph+1)×(nwkw+pw+1) import torch from torch imp 阅读全文
posted @ 2023-09-17 08:22 AncilunKiang 阅读(60) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from d2l import torch as d2l 6.2.1 互相关计算 X = torch.tensor([[0.0, 1.0, 2.0], [3.0, 4.0, 5.0], [6.0, 7.0, 8.0]]) K = t 阅读全文
posted @ 2023-09-16 09:13 AncilunKiang 阅读(102) 评论(0) 推荐(0) 编辑
摘要:6.1.1 不变性 平移不变性(translation invariance): 不管检测对象出现在图像中的哪个位置,神经网络的前面几层应该对相同的图像区域具有相似的反应,即为“平移不变性”。 局部性(locality): 神经网络的前面几层应该只探索输入图像中的局部区域,而不过度在意图像中相隔较远 阅读全文
posted @ 2023-09-15 16:34 AncilunKiang 阅读(166) 评论(0) 推荐(0) 编辑
摘要:5.6.1 计算设备 import torch from torch import nn torch.device('cpu'), torch.device('cuda:0') # cuda等价于cuda:0(只有一块显卡没法试别的块号) (device(type='cpu'), device(ty 阅读全文
posted @ 2023-09-14 07:57 AncilunKiang 阅读(90) 评论(0) 推荐(0) 编辑
摘要:5.5.1 加载和保存 import torch from torch import nn from torch.nn import functional as F x = torch.arange(4) torch.save(x, 'x-file') # 使用 save 保存 x2 = torch 阅读全文
posted @ 2023-09-14 07:56 AncilunKiang 阅读(45) 评论(0) 推荐(0) 编辑
摘要:5.4.1 不带参数的层 import torch import torch.nn.functional as F from torch import nn class CenteredLayer(nn.Module): def __init__(self): super().__init__() 阅读全文
posted @ 2023-09-13 19:47 AncilunKiang 阅读(101) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn from d2l import torch as d2l 下面实例化的多层感知机的输入维度是未知的,因此框架尚未初始化任何参数,显示为“UninitializedParameter”。 net = nn.Sequential(nn. 阅读全文
posted @ 2023-09-12 14:55 AncilunKiang 阅读(333) 评论(0) 推荐(0) 编辑
摘要:import torch from torch import nn net = nn.Sequential(nn.Linear(4, 8), nn.ReLU(), nn.Linear(8, 1)) X = torch.rand(size=(2, 4)) net(X) tensor([[-0.3771 阅读全文
posted @ 2023-09-11 08:43 AncilunKiang 阅读(156) 评论(0) 推荐(0) 编辑
摘要:层: 接收一组输入 生成相应输出 由一组可调整参数描述 块: 可以描述单个层、由多个层组成的组件或整个模型本身 讨论“比单个层大”但是“比整个模型小”的组件“块”更有价值 从编程的角度看,块由类表示 块必须具有反向传播函数 # 以前章多层感知机的代码为例 import torch from torc 阅读全文
posted @ 2023-09-10 07:55 AncilunKiang 阅读(142) 评论(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 阅读(166) 评论(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 阅读(67) 评论(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 阅读(112) 评论(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 阅读(132) 评论(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 阅读(153) 评论(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 阅读(141) 评论(0) 推荐(1) 编辑

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