当前位置:网站首页>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
- 速看!2022年6月编程语言排行榜出炉!第一名太牛啦
- 企业数字化转型:信息化与数字化
- LeetCode 785:判断二分图
- Nokov motion capture system makes it possible for multi field cooperative UAV to build independently
- Topolvm: kubernetes local persistence scheme based on LVM, capacity aware, dynamically create PV, and easily use local disk
- Oracle/PLSQL: HexToRaw Function
- Shell script series (1) getting started
- Oracle/PLSQL: Replace Function
- 学习太极创客 — MQTT(六)ESP8266 发布 MQTT 消息
猜你喜欢
随机推荐
Oracle/PLSQL: Translate Function
学习太极创客 — MQTT(九)ESP8266 同时订阅和发布 MQTT 消息
Flink学习1:简介
Oracle/PLSQL: Replace Function
XSS attack (note)
学习太极创客 — MQTT 第二章(一)QoS 服务质量等级
Is the division of each capability domain of Dama, dcmm and other data management frameworks reasonable? Is there internal logic?
pytorch_grad_cam——pytorch下的模型特征(Class Activation Mapping, CAM)可视化库
DAMA、DCMM等数据管理框架各个能力域的划分是否合理?有内在逻辑吗?
lottie. JS creative switch button animal head
消费者追捧iPhone,在于它的性价比超越国产手机
Topolvm: kubernetes local persistence scheme based on LVM, capacity aware, dynamically create PV, and easily use local disk
Oracle/PLSQL: From_Tz function
Oracle/PLSQL: Lower Function
memcached基础9
What if asreml-r does not converge in operation?
Look! In June, 2022, the programming language ranking list was released! The first place is awesome
宁愿去996也不要待业在家啦!24岁,失业7个月,比上班更惨的,是没班可上
Oracle/PLSQL: Ltrim Function
Oracle/PLSQL: To_ Clob Function









