Feed Forward
FeedForward
Bases: Module
Creates a feed-forward neural network. The network includes a layer normalization, an activation function (LeakyReLU), and dropout layers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
d_model |
int
|
The number of expected features in the input. |
required |
kernel_size |
int
|
The size of the convolving kernel for the first conv1d layer. |
required |
dropout |
float
|
The dropout probability. |
required |
expansion_factor |
int
|
The expansion factor for the hidden layer size in the feed-forward network, default is 4. |
4
|
leaky_relu_slope |
float
|
Controls the angle of the negative slope of LeakyReLU activation, default is |
LEAKY_RELU_SLOPE
|
Source code in models/tts/delightful_tts/attention/feed_forward.py
forward(x)
Forward pass of the feed-forward neural network.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Tensor
|
Input tensor of shape (batch_size, seq_len, num_features). |
required |
Returns:
Name | Type | Description |
---|---|---|
Tensor |
Tensor
|
Output tensor of shape (batch_size, seq_len, num_features). |