Ref2VA/audio_vae/dac_utils.py
362 B · 13 lines · python Raw
1 # SPDX-License-Identifier: MIT
2 # Adapted from https://github.com/jik876/hifi-gan under the MIT license.
3
4
5 def init_weights(m, mean=0.0, std=0.01):
6 classname = m.__class__.__name__
7 if classname.find("Conv") != -1:
8 m.weight.data.normal_(mean, std)
9
10
11 def get_padding(kernel_size, dilation=1):
12 return int((kernel_size * dilation - dilation) / 2)
13