学习笔记414—Sigmoid函数求导

发布时间 2023-08-28 15:39:14作者: 何弈

Sigmoid函数求导

基础知识:

 Sigmoid函数:

 Sigmoid图形:

 生成Sigmoid图形代码:

import torch
from d2l import torch as d2l
%matplotlib inline

x=torch.arange(-8.0,8.0,0.1,requires_grad=True)
sigmoid=torch.nn.Sigmoid()
y=sigmoid(x)

d2l.plot(x.detach(),y.detach(),'x','sigmoid(x)',figsize=(5,2.5))

 

求导过程:

故Sigmoid函数的求导结果为:

 

参考链接:https://zhuanlan.zhihu.com/p/452684332