当前位置:网站首页>Activate function and its gradient
Activate function and its gradient
2022-07-05 22:43:00 【dying_ star】
Activation function ----sigmoid()
tanh Activation function
relu Activation function
softmax Activation function
here yi representative pi, zi Independent variable ,0<=pi<=1,p1+p2+...+pi+...+pc=1
Find gradient function
autograd.grad() Directly return gradient information
.backward() Attach gradient attributes to variables
Perceptron gradient derivation
import torch
from torch.nn import functional as F
x=torch.randn(1,10)
w=torch.randn(2,10,requires_grad=True)# Mark w For objects that need gradient information
o=torch.sigmoid([email protected]())# To sum by weight , use sigmoid() Activation function
loss=F.mse_loss(torch.ones(1,2),o)# Mean square loss function
loss.backward()# Right w Gradient of
print(w.grad)
Output gradient
tensor([[ 0.0066, -0.0056, -0.0027, 0.0118, -0.0050, 0.0314, 0.0100, -0.0274,
-0.0006, -0.0448],
[ 0.0182, -0.0155, -0.0075, 0.0326, -0.0138, 0.0871, 0.0277, -0.0760,
-0.0017, -0.1241]])
边栏推荐
- Spectrum analysis of ADC sampling sequence based on stm32
- 點到直線的距離直線的交點及夾角
- Solutions for unexplained downtime of MySQL services
- Go语言学习教程(十五)
- [untitled]
- Distance entre les points et les lignes
- 谷歌地图案例
- Metaverse Ape获Negentropy Capital种子轮融资350万美元
- Paddle Serving v0.9.0 重磅发布多机多卡分布式推理框架
- Usage Summary of scriptable object in unity
猜你喜欢
Analysis of the problem that the cookie value in PHP contains a plus sign (+) and becomes a space
What if win11 is missing a DLL file? Win11 system cannot find DLL file repair method
Cobaltstrike builds an intranet tunnel
实战:fabric 用户证书吊销操作流程
Unity Max and min constraint adjustment
How can easycvr cluster deployment solve the massive video access and concurrency requirements in the project?
I closed the open source project alinesno cloud service
谷歌地图案例
The difference between MVVM and MVC
BFC block level formatting context
随机推荐
Character conversion PTA
我把开源项目alinesno-cloud-service关闭了
关于MySQL的30条优化技巧,超实用
Distance entre les points et les lignes
GWT module may need to be (RE) compiled reduce - GWT module may need to be (RE) compiled reduce
【无标题】
QT creator 7 beta release
Assign the output of a command to a variable [repeat] - assigning the output of a command to a variable [duplicate]
Technology cloud report won the special contribution award for the 10th anniversary of 2013-2022 of the "cloud Ding Award" of the global cloud computing conference
点到直线的距离直线的交点及夹角
Metaverse ape ape community was invited to attend the 2022 Guangdong Hong Kong Macao Great Bay metauniverse and Web3.0 theme summit to share the evolution of ape community civilization from technology
Spectrum analysis of ADC sampling sequence based on stm32
My experience and summary of the new Zhongtai model
Damn, window in ie open()
Event trigger requirements of the function called by the event trigger
实战:fabric 用户证书吊销操作流程
Request preview display of binary data and Base64 format data
[error record] groovy function parameter dynamic type error (guess: groovy.lang.missingmethodexception: no signature of method)
QT creator 7-cmake update
700. Search in a Binary Search Tree. Sol