espnet2.enh.layers.ncsnpp_utils.layers.default_init
Less than 1 minute
espnet2.enh.layers.ncsnpp_utils.layers.default_init
espnet2.enh.layers.ncsnpp_utils.layers.default_init(scale=1.0)
Initialize weights using the same method as DDPM.
This function returns a weight initialization function that uses variance scaling based on the specified scale. The initialization method is particularly designed to work well with Deep Denoising Probabilistic Models (DDPM).
- Parameters:scale (float) – The scale for the variance scaling initializer. If scale is set to 0, it will be replaced with a small value (1e-10) to avoid division by zero.
- Returns: A function that takes a shape as input and returns initialized weights according to the variance scaling method.
- Return type: function
Examples
>>> init_func = default_init(scale=0.1)
>>> weights = init_func((64, 128)) # Initialize weights of shape (64, 128)
NOTE
This function is particularly useful in neural network architectures where weight initialization can significantly affect the training dynamics.