Zero out the parameters of a module and return it.
(module)
| 33 | |
| 34 | |
| 35 | def zero_module(module): |
| 36 | """ |
| 37 | Zero out the parameters of a module and return it. |
| 38 | """ |
| 39 | for p in module.parameters(): |
| 40 | p.detach().zero_() |
| 41 | return module |
| 42 | |
| 43 | |
| 44 | def scale_module(module, scale): |