Zero out the parameters of a module and return it.
(module)
| 28 | |
| 29 | |
| 30 | def zero_module(module): |
| 31 | """ |
| 32 | Zero out the parameters of a module and return it. |
| 33 | """ |
| 34 | for p in module.parameters(): |
| 35 | p.detach().zero_() |
| 36 | return module |
| 37 | |
| 38 | |
| 39 | def scale_for_cosine_sim(q, k, scale, eps): |