当前位置:网站首页>The use and introduction of pytorch 23 hook and the implementation of plug and play dropblock based on hook
The use and introduction of pytorch 23 hook and the implementation of plug and play dropblock based on hook
2022-06-27 02:16:00 【Ten thousand miles' journey to】
Hook( hook ): It literally means to hook a function , Modify input data or other operations before its execution , Or modify the output or other operations after its execution . adopt hook Operation can lock a layer object (model Module in ) Life cycle of , Monitor its execution status and execution results . stay pytorch in , Provide a wealth of hook api, So we can monitor and modify tensor In the model forword The state of . In Ben Bowen , be based on hook The operation realizes plug and play Dropout operation , Support dorpblock、dropout2d And so on Dropout operation .
stay pytorch in layer The life cycle of can be simply understood as : Definition -> initialization -> Forward propagation -> Back propagation -> The destruction . Forward propagation and back propagation are the most important parts of its execution process , Through the analysis of forward propagation and back propagation hook operation , You can get the execution status of data in the model ( Such as the implementation CAM) And modify it ( Such as gradient clipping ).
Grad-CAM: Gradient based category response feature visualization . adopt hook Operation to obtain the corresponding layer Of forward In the process feature map Of output and backward In the process grad Of output, And then feature_map_output And backward_grad_output Multiply the corresponding elements in , Then realize the visualization of category response characteristics .
Gradient cut : Yes layer Of backward In the process grad Of output The value of , So that it cannot be greater than a specific value, resulting in gradient explosion .
1、pytorch Medium hook Interface
pytorch in the light of Model、modules.module、ScriptModule and Tensor 4 Corresponding modules are provided hook Interface . The needle is for Tensor Only one is provided for back propagation hook, because tensor The forward propagation process is fully visible to users . Aim at Model、modules.module、ScriptModul
边栏推荐
猜你喜欢

Flink learning 3: data processing mode (stream batch)

学习太极创客 — MQTT(七)MQTT 主题进阶

宁愿去996也不要待业在家啦!24岁,失业7个月,比上班更惨的,是没班可上

为什么传递SPIF_SENDCHANGE标志SystemParametersInfo会挂起?

Would rather go to 996 than stay at home! 24 years old, unemployed for 7 months, worse than work, no work

Learn Tai Chi Maker - mqtt (VI) esp8266 releases mqtt message

“所有专业都在劝退”,对大学生最友好的竟然是它?

1、项目准备与新建

消费者追捧iPhone,在于它的性价比超越国产手机

CVPR2022 | PointDistiller:面向高效紧凑3D检测的结构化知识蒸馏
随机推荐
C language -- Design of employee information management system
Memcached basics 14
Flink Learning 2: Application Scenarios
dat. gui. JS star circle track animation JS special effect
C# Tcp服务器如何限制同一个IP的连接数量?
Oracle/PLSQL: To_ Clob Function
速看!2022年6月编程语言排行榜出炉!第一名太牛啦
Memcached basics 15
Flink learning 3: data processing mode (stream batch)
Oracle/PLSQL: HexToRaw Function
Flink学习5:工作原理
Oracle/PLSQL: Translate Function
paddlepaddle 21 基于dropout实现用4行代码dropblock
Oracle/PLSQL: Lpad Function
memcached基礎12
"All majors are persuading them to quit." is it actually the most friendly to college students?
按键控制LED状态翻转
SQLite reader plug-in tests SQLite syntax
Nokov motion capture system makes it possible for multi field cooperative UAV to build independently
jwt的认证流程和使用案例