torch.nn.utils.remove_spectral_norm
function remove_spectral_norm<T extends Module>(module: T, options?: RemoveSpectralNormOptions): Tfunction remove_spectral_norm<T extends Module>(module: T, name: string, options?: RemoveSpectralNormOptions): TRemove the spectral normalization reparameterization from a module.
Parameters
moduleT- Module with spectral normalization applied
optionsRemoveSpectralNormOptionsoptional- Optional settings for removing spectral normalization
Returns
T– The module with spectral normalization removedExamples
// Apply spectral norm
torch.nn.utils.spectral_norm(conv);
// Later, remove it (e.g., before saving)
torch.nn.utils.remove_spectral_norm(conv, { name: 'weight' });