網站首頁 編程語言 正文
先看代碼
m = nn.Identity( 54, unused_argument1=0.1, unused_argument2=False ) input = torch.randn(128, 20) output = m(input) >>> print(output.size()) torch.Size([128, 20])
這是官方文檔中給出的代碼,很明顯,沒有什么變化,輸入的是torch,輸出也是,并且給定的參數似乎并沒有起到變化的效果。
看源碼
class Identity(Module): r"""A placeholder identity operator that is argument-insensitive. Args: args: any argument (unused) kwargs: any keyword argument (unused) Examples:: >>> m = nn.Identity(54, unused_argument1=0.1, unused_argument2=False) >>> input = torch.randn(128, 20) >>> output = m(input) >>> print(output.size()) torch.Size([128, 20]) """ def __init__(self, *args, **kwargs): super(Identity, self).__init__() def forward(self, input: Tensor) -> Tensor: return input
這相當的簡潔明了啊,輸入是啥,直接給輸出,不做任何的改變。再看文檔中的一句話:A placeholder identity operator that is argument-insensitive.
翻譯一下就是:不區分參數的占位符標識運算符。百度翻譯,其實意思就是這個網絡層的設計是用于占位的,即不干活,只是有這么一個層,放到殘差網絡里就是在跳過連接的地方用這個層,顯得沒有那么空虛!
應用
例如此時:如果此時我們使用了se_layer,那么就SELayer(dim),否則就輸入什么就輸出什么(什么都不做)
總結
原文鏈接:https://blog.csdn.net/TTLoveYuYu/article/details/118224298
相關推薦
- 2022-12-07 React中路由的參數傳遞路由的配置文件詳解_React
- 2022-04-11 android原生與kotlin驗證碼倒計時
- 2022-05-27 python中SQLAlchemy使用前端頁面實現插入數據_python
- 2022-04-09 windows一鍵啟動多個bat批處理文件或者啟動多個cmd窗口執行命令
- 2022-07-29 python中open函數對文件處理的使用教程_python
- 2022-03-20 關于Rancher部署并導入K8S集群的問題_云其它
- 2022-12-27 golang中日期操作之日期格式化及日期轉換_Golang
- 2022-05-11 垃圾收集器ParNew&CMS與底層三色標記算法詳解
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支