Zero out the parameters of a module and return it.
(module)
| 7 | |
| 8 | |
| 9 | def zero_module(module): |
| 10 | """ |
| 11 | Zero out the parameters of a module and return it. |
| 12 | """ |
| 13 | for p in module.parameters(): |
| 14 | p.detach().zero_() |
| 15 | return module |
| 16 | |
| 17 | |
| 18 | @ATTENTIONS.register_module() |