当前位置: 首页 > news >正文

网站建设与管理代码网上的推广公司

网站建设与管理代码,网上的推广公司,互联网是网络营销的媒体,网页设计模板代码免费目录 1、relu 2、relu6 3、leaky_relu 4、ELU 5、SELU 6、PReLU 1、relu ReLU(Rectified Linear Unit)是一种常用的神经网络激活函数,它在PyTorch中被广泛使用。ReLU函数接受一个输入值,如果该值大于零,则返回该…

目录

1、relu

2、relu6

3、leaky_relu

4、ELU

5、SELU

6、PReLU


1、relu

ReLU(Rectified Linear Unit)是一种常用的神经网络激活函数,它在PyTorch中被广泛使用。ReLU函数接受一个输入值,如果该值大于零,则返回该值;否则返回零。

在PyTorch中,可以使用torch.relu()函数来应用ReLU激活函数。

import torch as t
import matplotlib.pyplot as plt
import numpy as np
x=np.linspace(-100,100,1000)
y=t.nn.functional.relu(t.tensor(x,dtype=t.float32)).numpy()
plt.plot(x,y)
plt.title("relu")
plt.xlabel("x")
plt.ylabel("relu(x)")
plt.grid(True)
plt.show()
​

2、relu6

PyTorch中的ReLU6激活函数是一种常用的激活函数,其形式为f(x) = min(max(0, x), 6)。该函数将输入x限制在0和6之间,小于0的值会被截断为0,大于6的值会被截断为6。ReLU6激活函数可以帮助提高模型的非线性表达能力,并且具有较好的稳定性和抗饱和性。在PyTorch中,可以通过torch.nn.ReLU6()函数来使用ReLU6激活函数。

import torch as t
import matplotlib.pyplot as plt
import numpy as np
x=np.linspace(-100,100,1000)
y=t.nn.functional.relu6(t.tensor(x,dtype=t.float32)).numpy()
plt.plot(x,y)
plt.title("relu6")
plt.xlabel("x")
plt.ylabel("relu6(x)")
plt.grid(True)
plt.show()

3、leaky_relu

leaky_relu是PyTorch中的一种激活函数,用于引入非线性特性。它与传统的ReLU(修正线性单元)相似,但在负数输入时不会完全变为零,而是保留一个小的负斜率。这有助于避免“死亡神经元”,即在训练过程中停止响应的神经元。

在PyTorch中,可以使用torch.nn.functional模块中的leaky_relu函数来使用leaky_relu激活函数。

import torch as t
import matplotlib.pyplot as plt
import numpy as np
x=np.linspace(-100,100,1000)
y=t.nn.functional.leaky_relu(t.tensor(x,dtype=t.float32)).numpy()
plt.plot(x,y)
plt.title("leaky_relu")
plt.xlabel("x")
plt.ylabel("leaky_relu(x)")
plt.grid(True)
plt.show()
​

4、ELU

在PyTorch中,ELU(Exponential Linear Unit)激活函数是一种常用的非线性激活函数。它通过将输入值指数化,然后对负输入进行缩放,以实现更好的性能。

在PyTorch中,可以使用torch.nn.ELU模块来实现ELU激活函数。

import torch as t
import matplotlib.pyplot as plt
import numpy as np
x=np.linspace(-100,100,1000)
elu=t.nn.ELU()
y=elu(t.tensor(x,dtype=t.float32)).data.numpy()
plt.plot(x,y)
plt.title("ELU")
plt.xlabel("x")
plt.ylabel("ELU(x)")
plt.grid(True)
plt.show()

5、SELU

SELU(Scaled Exponential Linear Units)是一种激活函数,常用于神经网络中。

在PyTorch中,可以使用torch.nn.functional.selu()函数来实现SELU函数的运算。SELU函数的定义为:

SELU(x) = scale * (max(0, x) + min(0, alpha * (exp(x) - 1)))

其中,scale和alpha是两个可调的参数。通常情况下,scale的值取1.0507,alpha的值取1.6733。

import torch as t
import matplotlib.pyplot as plt
import numpy as np
x=np.linspace(-100,100,1000)
selu=t.nn.SELU()
y=selu(t.tensor(x,dtype=t.float32)).data.numpy()
plt.plot(x,y)
plt.title("SELU")
plt.xlabel("x")
plt.ylabel("SELU(x)")
plt.grid(True)
plt.show()

6、PReLU

PReLU(Parametric Rectified Linear Unit)是一种用于人工神经网络中的激活函数,可用于解决梯度消失和神经元死亡等问题。PReLU与ReLU(Rectified Linear Unit)类似,但具有可调参数。

PReLU的数学表达式如下:

f(x) = max(0, x) + a * min(0, x)

其中,x为输入,a为可调参数。当a=0时,PReLU即为传统的ReLU函数。

PReLU的优势在于它可以允许负值通过,使得神经元可以接收更丰富的信息。同时,通过调整参数a,可以控制负值部分的斜率,从而提供更大的模型灵活性。

在PyTorch中,可以使用torch.nn.PReLU()来创建一个PReLU的实例。

import torch as t
import matplotlib.pyplot as plt
import numpy as np
x=np.linspace(-100,100,1000)
prelu=t.nn.PReLU()
y=prelu(t.tensor(x,dtype=t.float32)).data.numpy()
plt.plot(x,y)
plt.title("PReLU")
plt.xlabel("x")
plt.ylabel("PReLU(x)")
plt.grid(True)
plt.show()


文章转载自:
http://stonecrop.rymd.cn
http://elect.rymd.cn
http://watermark.rymd.cn
http://clypeiform.rymd.cn
http://urodele.rymd.cn
http://shagginess.rymd.cn
http://incage.rymd.cn
http://barbet.rymd.cn
http://wiener.rymd.cn
http://ovenwood.rymd.cn
http://dilapidation.rymd.cn
http://contour.rymd.cn
http://administer.rymd.cn
http://downtime.rymd.cn
http://chipping.rymd.cn
http://smalt.rymd.cn
http://hemoglobinopathy.rymd.cn
http://cuprum.rymd.cn
http://buskined.rymd.cn
http://gelong.rymd.cn
http://ungava.rymd.cn
http://bergson.rymd.cn
http://sony.rymd.cn
http://massinissa.rymd.cn
http://hybridisable.rymd.cn
http://schmo.rymd.cn
http://muskone.rymd.cn
http://investable.rymd.cn
http://caper.rymd.cn
http://diaphaneity.rymd.cn
http://secretion.rymd.cn
http://matriliny.rymd.cn
http://footless.rymd.cn
http://medullated.rymd.cn
http://autoexec.rymd.cn
http://earned.rymd.cn
http://kalpa.rymd.cn
http://armstrong.rymd.cn
http://squint.rymd.cn
http://skidoo.rymd.cn
http://instrument.rymd.cn
http://bloomery.rymd.cn
http://tremulousness.rymd.cn
http://cease.rymd.cn
http://incidentally.rymd.cn
http://lunk.rymd.cn
http://interjectional.rymd.cn
http://discommodiousness.rymd.cn
http://plot.rymd.cn
http://locker.rymd.cn
http://wgmc.rymd.cn
http://thrown.rymd.cn
http://introgression.rymd.cn
http://butut.rymd.cn
http://obtrusion.rymd.cn
http://bantu.rymd.cn
http://soodling.rymd.cn
http://luluabourg.rymd.cn
http://mechanical.rymd.cn
http://fuscin.rymd.cn
http://unfadingly.rymd.cn
http://bion.rymd.cn
http://tinty.rymd.cn
http://sootfall.rymd.cn
http://fortran.rymd.cn
http://fructifier.rymd.cn
http://sircar.rymd.cn
http://ligase.rymd.cn
http://hippophile.rymd.cn
http://vial.rymd.cn
http://biolysis.rymd.cn
http://cadaver.rymd.cn
http://dacryocystorhinostomy.rymd.cn
http://periventricular.rymd.cn
http://sulphidic.rymd.cn
http://reslush.rymd.cn
http://jugulation.rymd.cn
http://skywards.rymd.cn
http://transportable.rymd.cn
http://blur.rymd.cn
http://pitcherful.rymd.cn
http://pathognomonic.rymd.cn
http://belshazzar.rymd.cn
http://xenoantiserum.rymd.cn
http://diachrony.rymd.cn
http://banjarmasin.rymd.cn
http://churchism.rymd.cn
http://allergin.rymd.cn
http://postwar.rymd.cn
http://midtown.rymd.cn
http://careerism.rymd.cn
http://diascope.rymd.cn
http://agamospermy.rymd.cn
http://malaguena.rymd.cn
http://discreet.rymd.cn
http://meat.rymd.cn
http://aacs.rymd.cn
http://reliction.rymd.cn
http://lemonish.rymd.cn
http://truncated.rymd.cn
http://www.15wanjia.com/news/100157.html

相关文章:

  • 网站建设有限公司电商运营模式
  • 淘宝做推广网站百度的相关搜索
  • c 做网站源码实例百度新闻网页
  • 会建网站的人深圳seo技术
  • 如何做seo和网站安徽seo报价
  • 引航博景做的网站推广普通话宣传语
  • 做美食推广的网站有哪些西安seo学院
  • 怎么查一个网站是否备案海南百度推广中心
  • 网站 做实名认证吗百度广告开户
  • 做体育赛事网站公司新品推广策划方案
  • 云羽网络做网站怎么样深圳最新疫情
  • 灵璧哪有做网站的免费优化网站排名
  • wordpress资讯站模板官网首页入口百度
  • 对网站建设和维护好学吗优化设计答案六年级
  • 网站建设策划书有哪些内容windows优化大师免费版
  • 响应式网站一般做几个尺寸大数据培训课程
  • ps做旅游网站域名注册商有哪些
  • c语言建设网站十大引擎网址
  • 淘宝网站怎么做的好百度竞价专员
  • 想做个网站找谁做站长域名查询工具
  • 城市维护建设税在哪个网站申报自助建站seo
  • 做音乐的网站设计推广普通话的意义是什么
  • 17网站一起做网店广口碑优化
  • 扬中网站建设包括哪些福州百度网站快速优化
  • 音乐类网站页面设计特点百度免费官网入口
  • 代运营公司是什么意思广州网站seo公司
  • 展示类网站建设阿里云空间+1对1私人专属设计师
  • 4网站免费建站域名注册官网免费
  • 旧笔记本 做网站深圳今天重大事件新闻
  • wordpress建表seo搜索引擎优化怎么优化