Args: in_size: input dimension hidden_size: hidden layer dimension dropout: dropout probability Output: (return value in forward) a tensor of shape (batch_size, hidden_size)
(self, in_size, hidden_size, dropout)
| 12 | ''' |
| 13 | |
| 14 | def __init__(self, in_size, hidden_size, dropout): |
| 15 | ''' |
| 16 | Args: |
| 17 | in_size: input dimension |
| 18 | hidden_size: hidden layer dimension |
| 19 | dropout: dropout probability |
| 20 | Output: |
| 21 | (return value in forward) a tensor of shape (batch_size, hidden_size) |
| 22 | ''' |
| 23 | super(MLPEncoder, self).__init__() |
| 24 | # self.norm = nn.BatchNorm1d(in_size) |
| 25 | self.drop = nn.Dropout(p=dropout) |
| 26 | self.linear_1 = nn.Linear(in_size, hidden_size) |
| 27 | self.linear_2 = nn.Linear(hidden_size, hidden_size) |
| 28 | self.linear_3 = nn.Linear(hidden_size, hidden_size) |
| 29 | |
| 30 | def forward(self, x): |
| 31 | ''' |