当前位置:网站首页>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]])
边栏推荐
- Cobaltstrike builds an intranet tunnel
- Calculation method of boundary IOU
- 请求二进制数据和base64格式数据的预览显示
- Metaverse Ape获Negentropy Capital种子轮融资350万美元
- opencv 判断点在多边形内外
- 基于STM32的ADC采样序列频谱分析
- VOT Toolkit环境配置与使用
- [error record] file search strategy in groovy project (src/main/groovy/script.groovy needs to be used in the main function | groovy script directly uses the relative path of code)
- Three "factions" in the metauniverse
- MCU case -int0 and INT1 interrupt count
猜你喜欢
50. Pow(x, n). O(logN) Sol
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
我把开源项目alinesno-cloud-service关闭了
Qtquick3d real time reflection
[error record] groovy function parameter dynamic type error (guess: groovy.lang.missingmethodexception: no signature of method)
Arduino measures AC current
What about data leakage? " Watson k'7 moves to eliminate security threats
513. Find the value in the lower left corner of the tree
Event trigger requirements of the function called by the event trigger
Unique occurrence times of leetcode simple questions
随机推荐
鏈錶之雙指針(快慢指針,先後指針,首尾指針)
请求二进制数据和base64格式数据的预览显示
VOT toolkit environment configuration and use
Global and Chinese markets of industrial pH meters 2022-2028: Research Report on technology, participants, trends, market size and share
d3dx9_ What if 29.dll is missing? System missing d3dx9_ Solution of 29.dll file
谷歌地图案例
Business introduction of Zhengda international futures company
Metaverse Ape上线倒计时,推荐活动火爆进行
Global and Chinese market of networked refrigerators 2022-2028: Research Report on technology, participants, trends, market size and share
VOT Toolkit环境配置与使用
Platformio create libopencm3 + FreeRTOS project
Usage Summary of scriptable object in unity
How to quickly experience oneos
MCU case -int0 and INT1 interrupt count
What changes has Web3 brought to the Internet?
What about data leakage? " Watson k'7 moves to eliminate security threats
Practice: fabric user certificate revocation operation process
关于MySQL的30条优化技巧,超实用
Navigation day answer applet: preliminary competition of navigation knowledge competition
Postman核心功能解析-参数化和测试报告