Construct an PositionwiseFeedForward object.
(self, idim, hidden_units, dropout_rate, activation=torch.nn.ReLU())
| 59 | """ |
| 60 | |
| 61 | def __init__(self, idim, hidden_units, dropout_rate, activation=torch.nn.ReLU()): |
| 62 | """Construct an PositionwiseFeedForward object.""" |
| 63 | super(PositionwiseFeedForward, self).__init__() |
| 64 | self.w_1 = torch.nn.Linear(idim, hidden_units) |
| 65 | self.w_2 = torch.nn.Linear(hidden_units, idim) |
| 66 | self.dropout = torch.nn.Dropout(dropout_rate) |
| 67 | self.activation = activation |
| 68 | |
| 69 | def forward(self, x): |
| 70 | """Forward function.""" |