Embeddings
FixedEmbedding
Bases: Module
Fixed Embedding class that creates a fixed embedding of a given maximum length and features.
Source code in models/tts/styledtts2/diffusion/embeddings.py
__init__(max_length, features)
Initialize the FixedEmbedding with a maximum length and features.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_length |
int
|
The maximum length of the embedding. |
required |
features |
int
|
The number of features of the embedding. |
required |
Source code in models/tts/styledtts2/diffusion/embeddings.py
forward(x)
Forward pass of the FixedEmbedding.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Tensor
|
The input tensor. |
required |
Returns:
Name | Type | Description |
---|---|---|
Tensor |
Tensor
|
The output tensor. |
Source code in models/tts/styledtts2/diffusion/embeddings.py
LearnedPositionalEmbedding
Bases: Module
Learned Positional Embedding class that creates a learned positional embedding of a given dimension. Used for continuous time.
Source code in models/tts/styledtts2/diffusion/embeddings.py
__init__(dim)
Initialize the LearnedPositionalEmbedding with a dimension.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dim |
int
|
The dimension of the embedding. |
required |
Source code in models/tts/styledtts2/diffusion/embeddings.py
forward(x)
Forward pass of the LearnedPositionalEmbedding.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Tensor
|
The input tensor. |
required |
Returns:
Name | Type | Description |
---|---|---|
Tensor |
Tensor
|
The output tensor. |
Source code in models/tts/styledtts2/diffusion/embeddings.py
SinusoidalEmbedding
Bases: Module
Sinusoidal Embedding class that creates a sinusoidal embedding of a given dimension.
Source code in models/tts/styledtts2/diffusion/embeddings.py
__init__(dim)
Initialize the SinusoidalEmbedding with a dimension.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dim |
int
|
The dimension of the embedding. |
required |
forward(x)
Forward pass of the SinusoidalEmbedding.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Tensor
|
The input tensor. |
required |
Returns:
Name | Type | Description |
---|---|---|
Tensor |
Tensor
|
The output tensor. |
Source code in models/tts/styledtts2/diffusion/embeddings.py
TimePositionalEmbedding(dim, out_features)
Creates a time positional embedding of a given dimension and output features.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dim |
int
|
The dimension of the embedding. |
required |
out_features |
int
|
The number of output features. |
required |
Returns:
Type | Description |
---|---|
Module
|
nn.Module: The time positional embedding module. |