当前位置:网站首页>Pytorch MLP
Pytorch MLP
2022-07-05 11:43:00 【My abyss, my abyss】
1、 Hidden layer
Input layer and hidden layer are fully connected
The hidden layer and the output layer are fully connected
2、 Activation function
Activation function (activation function) Determine whether neurons should be activated by calculating the weighted sum and adding bias , They convert an input signal into a differentiable operation of an output .
3、 Summary
The multi-layer perceptron adds one or more fully connected hidden layers between the output layer and the input layer , And convert the output of the hidden layer through the activation function . So that the multi-layer perceptron can carry out nonlinear fitting .
Common activation functions include ReLU function 、sigmoid Functions and tanh function .
import torch
from torch import nn
from d2l import torch as d2l
net = nn.Sequential(nn.Flatten(),
nn.Linear(784, 256),
nn.ReLU(),
nn.Linear(256, 10))
def init_weights(m):
if type(m) == nn.Linear:
nn.init.normal_(m.weight, std=0.01)
net.apply(init_weights);
batch_size, lr, num_epochs = 256, 0.1, 10
loss = nn.CrossEntropyLoss(reduction='none')
trainer = torch.optim.SGD(net.parameters(), lr=lr)
train_iter, test_iter = d2l.load_data_fashion_mnist(batch_size)
d2l.train_ch3(net, train_iter, test_iter, loss, num_epochs, trainer)
边栏推荐
- redis 集群模式原理
- SET XACT_ABORT ON
- I used Kaitian platform to build an urban epidemic prevention policy inquiry system [Kaitian apaas battle]
- 高校毕业求职难?“百日千万”网络招聘活动解决你的难题
- Cdga | six principles that data governance has to adhere to
- Question and answer 45: application of performance probe monitoring principle node JS probe
- 1个插件搞定网页中的广告
- 石油化工企业安全生产智能化管控系统平台建设思考和建议
- POJ 3176 cow bowling (DP | memory search)
- 7.2 daily study 4
猜你喜欢
【上采样方式-OpenCV插值】
Cdga | six principles that data governance has to adhere to
【使用TensorRT通过ONNX部署Pytorch项目】
[singleshotmultiboxdetector (SSD, single step multi frame target detection)]
无密码身份验证如何保障用户隐私安全?
12. (map data) cesium city building map
网络五连鞭
Differences between IPv6 and IPv4 three departments including the office of network information technology promote IPv6 scale deployment
全网最全的新型数据库、多维表格平台盘点 Notion、FlowUs、Airtable、SeaTable、维格表 Vika、飞书多维表格、黑帕云、织信 Informat、语雀
Evolution of multi-objective sorting model for classified tab commodity flow
随机推荐
Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in
以交互方式安装ESXi 6.0
Project summary notes series wstax kt session2 code analysis
C # implements WinForm DataGridView control to support overlay data binding
COMSOL--建立几何模型---二维图形的建立
[mainstream nivida graphics card deep learning / reinforcement learning /ai computing power summary]
7.2 daily study 4
Differences between IPv6 and IPv4 three departments including the office of network information technology promote IPv6 scale deployment
How can edge computing be combined with the Internet of things?
COMSOL -- 3D casual painting -- sweeping
Solve readobjectstart: expect {or N, but found n, error found in 1 byte of
yolov5目标检测神经网络——损失函数计算原理
【上采样方式-OpenCV插值】
跨境电商是啥意思?主要是做什么的?业务模式有哪些?
Technology sharing | common interface protocol analysis
AutoCAD -- mask command, how to use CAD to locally enlarge drawings
pytorch-线性回归
MySQL statistical skills: on duplicate key update usage
Acid transaction theory
COMSOL--三维图形的建立