Args: input_size (int): The number of expected features in the input x hidden_size (int): The number of features in the hidden state h num_layers (int): Number of recurrent layers. Default: 1 nonlinearity (string): The non-linearity to use.
(
self,
input_size,
hidden_size,
num_layers=1,
nonlinearity="tanh",
bias=True,
batch_first=False,
dropout=0,
bidirectional=False,
)
| 1132 | """ |
| 1133 | |
| 1134 | def __init__( |
| 1135 | self, |
| 1136 | input_size, |
| 1137 | hidden_size, |
| 1138 | num_layers=1, |
| 1139 | nonlinearity="tanh", |
| 1140 | bias=True, |
| 1141 | batch_first=False, |
| 1142 | dropout=0, |
| 1143 | bidirectional=False, |
| 1144 | ): |
| 1145 | """ |
| 1146 | Args: |
| 1147 | input_size (int): The number of expected features in the input x |
| 1148 | hidden_size (int): The number of features in the hidden state h |
| 1149 | num_layers (int): Number of recurrent layers. Default: 1 |
| 1150 | nonlinearity (string): The non-linearity to use. Default: 'tanh' |
| 1151 | bias (bool): If False, then the layer does not use bias weights. |
| 1152 | Default: True |
| 1153 | batch_first (bool): If True, then the input and output tensors |
| 1154 | are provided as (batch, seq, feature). Default: False |
| 1155 | dropout (float): If non-zero, introduces a Dropout layer on the |
| 1156 | outputs of each RNN layer except the last layer, with dropout |
| 1157 | probability equal to dropout. Default: 0 |
| 1158 | bidirectional (bool): If True, becomes a bidirectional RNN. |
| 1159 | Default: False |
| 1160 | """ |
| 1161 | super(RNN, self).__init__() |
| 1162 | |
| 1163 | self.input_size = input_size |
| 1164 | self.hidden_size = hidden_size |
| 1165 | self.num_layers = num_layers |
| 1166 | self.nonlinearity = nonlinearity |
| 1167 | self.bias = bias |
| 1168 | self.batch_first = batch_first |
| 1169 | self.dropout = dropout |
| 1170 | self.bidirectional = bidirectional |
| 1171 | |
| 1172 | def initialize(self, xs, h0): |
| 1173 | Wx_shape = (self.input_size, self.hidden_size) |
no outgoing calls
no test coverage detected