AdaLayerNorm
AdaLayerNorm
Bases: Module
A class used to represent an adaptive layer normalization module.
Attributes:
Name | Type | Description |
---|---|---|
channels |
int
|
The number of channels in the input data. |
eps |
float
|
A small value added to the denominator for numerical stability. |
fc |
Linear
|
A fully connected layer used to compute the scale and shift parameters. |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style_dim |
int
|
The dimension of the style vector. |
required |
channels |
int
|
The number of channels in the input data. |
required |
eps |
float
|
A small value added to the denominator for numerical stability. Defaults to 1e-5. |
1e-05
|
Source code in models/tts/styledtts2/diffusion/ada_layer_norm.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
forward(x, s)
Applies adaptive layer normalization to the input tensor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Tensor
|
The input tensor of shape (batch_size, num_samples, num_channels). |
required |
s |
Tensor
|
The style tensor of shape (batch_size, style_dim). |
required |
Returns:
Type | Description |
---|---|
Tensor
|
torch.Tensor: The normalized tensor of the same shape as the input tensor. |
Source code in models/tts/styledtts2/diffusion/ada_layer_norm.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|