espnet2.gan_codec.shared.quantizer.modules.core_vq.uniform_init
Less than 1 minute
espnet2.gan_codec.shared.quantizer.modules.core_vq.uniform_init
espnet2.gan_codec.shared.quantizer.modules.core_vq.uniform_init(*shape: int)
Initialize a tensor with values drawn from a uniform distribution.
This function initializes a tensor with the specified shape using the Kaiming uniform initialization method. This method is often used to set the initial weights of neural networks to help with convergence during training.
- Parameters:*shape (int) – The desired shape of the output tensor.
- Returns: A tensor of the specified shape initialized using the Kaiming uniform method.
- Return type: torch.Tensor
Examples
>>> tensor = uniform_init(3, 4)
>>> tensor.shape
torch.Size([3, 4])
>>> tensor = uniform_init(2, 2, 2)
>>> tensor.shape
torch.Size([2, 2, 2])