(self, xs, h0)
| 1183 | self.b.set_value(0.0) |
| 1184 | |
| 1185 | def forward(self, xs, h0): |
| 1186 | # xs: a tuple or list of input tensors |
| 1187 | if not isinstance(xs, tuple): |
| 1188 | xs = tuple(xs) |
| 1189 | inputs = xs + (h0,) |
| 1190 | self.device_check(*inputs) |
| 1191 | # self.device_check(inputs[0], *self.params) |
| 1192 | self.device_check(inputs[0], self.Wx, self.Wh, self.b) |
| 1193 | batchsize = xs[0].shape[0] |
| 1194 | out = [] |
| 1195 | h = self.step_forward(xs[0], h0, self.Wx, self.Wh, self.b) |
| 1196 | out.append(h) |
| 1197 | for x in xs[1:]: |
| 1198 | assert x.shape[0] == batchsize |
| 1199 | h = self.step_forward(x, h, self.Wx, self.Wh, self.b) |
| 1200 | out.append(h) |
| 1201 | return out, h |
| 1202 | |
| 1203 | def step_forward(self, x, h, Wx, Wh, b): |
| 1204 | y2 = autograd.matmul(h, Wh) |
nothing calls this directly
no test coverage detected