参考
1: 分类问题引入1
2 分类问题引入2
一 分类问题
梯度下降算法是深度深度学习最基本的功能
以手写数字算法为例,数据集大小7000


input layer
列向量
Hidden layer
列向量 第一层神经元输入
第一层神经元输出
Output layer
![\hat{y}=a^{2}=\sigma(z^{2})\in [t,1]](https://1000bd.com/contentImg/2024/04/21/47b87a0b72bf65a4.png)

二 分类问题引入2
以手写数字识别为例
2.1 标签值为 one-hot [10,1]的列向量

2.2 学习过程
损失函数 
梯度更新过程(向量链式求导)
最后一层梯度更新:






第一层梯度更新



- # -*- coding: utf-8 -*-
- """
- Created on Thu Nov 17 21:56:22 2022
- @author: cxf
- """
-
- import torch.nn.functional as F
- import torch
-
- def one_hot(x):
-
- x = torch.tensor(x,dtype=int)
- y=F.one_hot(x,num_classes=10)
-
- print(y)
- return y
-
- if __name__ == "__main__":
-
- x =[1,2,3,4]
- one_hot(x)