torch.nn.SiLU
原型
CLASS torch.nn.SiLU(inplace=False)
?
torch.nn.SiLU
是 PyTorch 深度學(xué)習(xí)框架中的一個激活函數(shù),它代表 Sigmoid-Weighted Linear Unit(SiLU),也稱為 Swish 激活函數(shù)。SiLU 激活函數(shù)在深度學(xué)習(xí)中被廣泛使用,因為它在計算復(fù)雜度相對較低的情況下,在某些任務(wù)上比常用的激活函數(shù)(如 ReLU)具有更好的性能。與 ReLU 相比,SiLU 函數(shù)在處理負(fù)數(shù)輸入時引入了一些平滑性,可能有助于緩解梯度消失問題。?
圖
?
?代碼
import torch
import torch.nn as nn
m = nn.SiLU()
input = torch.randn(4)
output = m(input)
print("input: ", input) # input: tensor([ 0.3852, -0.5519, 0.8902, 2.1292])
print("output: ", output) # output: tensor([ 0.2292, -0.2017, 0.6311, 1.9029])
Lnton羚通是專注于音視頻算法、算力、云平臺的高科技人工智能企業(yè)。 公司基于視頻分析技術(shù)、視頻智能傳輸技術(shù)、遠(yuǎn)程監(jiān)測技術(shù)以及智能語音融合技術(shù)等, 擁有多款可支持ONVIF、RTSP、GB/T28181等多協(xié)議、多路數(shù)的音視頻智能分析服務(wù)器/云平臺。?
文章來源:http://www.zghlxwxcb.cn/news/detail-666778.html
?文章來源地址http://www.zghlxwxcb.cn/news/detail-666778.html
到了這里,關(guān)于Lnton羚通云算力平臺【PyTorch】教程:torch.nn.SiLU的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!