Multi-layer Perceptron

本文介绍了一种基于前向传输的双层网络算法验证过程。该算法通过将所有权重随机初始化为小数值来确保sigmod函数变化率适中,避免输出偏向极端值。通过遍历输入向量并计算隐藏层神经元的值来获取最终输出。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

验证双层网络算法;
基于前向传输(Forward)的算法:

每个节点(i,j,k) 来表示, v为输入权值, w输出权值
1. 所有w随机化为小的值;
2. repeat:
for each input vector:
//计算隐藏层中每个神经元的值
这里写图片描述
// 遍历所有层的节点, 知道得到输出值
// 这里写图片描述

权值初始化为小值, 因为如果权值过大, 则输出偏向于0或1, 这里的sigmod函数的变化率较小;

-------- TEST CPU -------- Loading MNIST data from files... Load images from ./mnist_data/train-images-idx3-ubyte, number: 60000, data shape: (60000, 784) Load images from ./mnist_data/train-labels-idx1-ubyte, number: 60000, data shape: (60000, 1) Load images from ./mnist_data/t10k-images-idx3-ubyte, number: 10000, data shape: (10000, 784) Load images from ./mnist_data/t10k-labels-idx1-ubyte, number: 10000, data shape: (10000, 1) Building multi-layer perception model... Fully connected layer with input 784, output 100. Relu layer Fully connected layer with input 100, output 100. Relu layer Fully connected layer with input 100, output 10. Softmax loss layer. Initializing parameters of each layer in MLP... inferencing time: 1.480017 Accuracy in test set: 0.087400 -------- TEST DLP -------- Init success: creating mlp layer ... creating relu layer ... [2025-5-31 22:49:1] [CNNL] [Warning]:[cnnlSetActivationDescriptor] is deprecated and will be removed in the future release, please use [cnnlSetActivationDescriptor_v5] instead. creating mlp layer ... creating relu layer ... creating mlp layer ... creating relu layer ... softmax output_shape: [10000 1 10 Loading MNIST data from files... Load images from ./mnist_data/t10k-images-idx3-ubyte, number: 10000, data shape: (10000, 784) Load images from ./mnist_data/t10k-labels-idx1-ubyte, number: 10000, data shape: (10000, 1) Loading parameters from file /opt/code_chap_2_3/code_chap_2_3_student/exp_2_2_mnist_mlp_dlp/stu_upload/weight.npy w1 shape: (78400,) b1 shape: (100,) loading params for layer fc1 ... Segmentation fault (core dumped)
最新发布
06-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值