当前位置:网站首页>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
边栏推荐
猜你喜欢

Learn Tai Chi Maker - mqtt Chapter 2 (3) reserved messages

WiFi-IoT 鸿蒙开发套件样例开发

解决cherry pick提交报错问题

平均风向风速计算(单位矢量法)

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

mmdetection 用yolox训练自己的coco数据集

学习太极创客 — MQTT 第二章(一)QoS 服务质量等级

Look! In June, 2022, the programming language ranking list was released! The first place is awesome

Learn Tai Chi Maker - mqtt (VIII) esp8266 subscribe to mqtt topic

速看!2022年6月编程语言排行榜出炉!第一名太牛啦
随机推荐
速看!2022年6月编程语言排行榜出炉!第一名太牛啦
Memcached Foundation 12
Oracle/PLSQL: NumToYMInterval Function
Oracle/PLSQL: Substr Function
mmdetection 用yolox训练自己的coco数据集
Memcached foundation 9
Oracle/PLSQL: Translate Function
perl语言中 fork()、exec()、waitpid() 、 $? >> 8 组合
Enterprise digital transformation: informatization and digitalization
Installing the Damon database using the command line
谷歌开始卷自己,AI架构Pathways加持,推出200亿生成模型
学习太极创客 — MQTT 第二章(一)QoS 服务质量等级
Oracle/PLSQL: Soundex Function
Flink學習2:應用場景
Yalm 100b: 100billion parameter open source large model from yandex, Russia, allowing commercial use
pytorch_grad_cam——pytorch下的模型特征(Class Activation Mapping, CAM)可视化库
DAMA、DCMM等数据管理框架各个能力域的划分是否合理?有内在逻辑吗?
Flink学习5:工作原理
D's appendto packaging
1、项目准备与新建