fn
remove_spectral_norm
→Moduleremove_spectral_norm(module: Module, name: str = 'weight')Reverse spectral_norm and restore a plain leaf parameter.
Copies module.<name>_orig back into a fresh leaf parameter
module.<name>, removes the <name>_u / <name>_v power-
iteration buffers, and detaches the forward pre-hook. Used before
exporting for inference when the normalisation overhead is no
longer wanted, or before fine-tuning without the spectral cap.
Parameters
moduleModuleModule previously passed through
spectral_norm.namestr= 'weight'Attribute name of the parameter to restore. Default
"weight".Returns
ModuleThe same module, with <name> as a plain
lucid.nn.parameter.Parameter carrying the unnormalised
weight that was being trained behind the parametrisation.
Raises
ValueErrorIf no spectral-norm registration exists on
<name>.Notes
The restored parameter is — not the rescaled that was visible during training. If you want the normalised matrix in the final checkpoint, copy it out before calling this function.
Examples
>>> remove_spectral_norm(disc)