網站首頁 編程語言 正文
先看代碼
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.
翻譯一下就是:不區(qū)分參數的占位符標識運算符。百度翻譯,其實意思就是這個網絡層的設計是用于占位的,即不干活,只是有這么一個層,放到殘差網絡里就是在跳過連接的地方用這個層,顯得沒有那么空虛!
應用
例如此時:如果此時我們使用了se_layer,那么就SELayer(dim),否則就輸入什么就輸出什么(什么都不做)
總結
原文鏈接:https://blog.csdn.net/TTLoveYuYu/article/details/118224298
相關推薦
- 2021-11-06 Docker下部署lnmp詳細步驟_docker
- 2022-05-27 使用Jedis線程池returnResource異常注意事項_Redis
- 2022-04-19 c#中token的使用方法實例_C#教程
- 2022-09-19 Python?matplotlib數據可視化圖繪制_python
- 2022-08-20 Redis+AOP+自定義注解實現限流_Redis
- 2022-04-18 詳解OpenGL?Shader抗鋸齒的實現_Android
- 2022-02-28 Error: clean-webpack-plugin only accepts an option
- 2023-02-25 pytest-fixture簡介及其用法講解_python
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環(huán)境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發(fā)現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支