Rnn forward. Args: ey: TODO. z_list: TODO. c_list: TODO. z_prev: TODO. c_prev: TODO.
(self, ey, z_list, c_list, z_prev, c_prev)
| 195 | return hs_pad.new_zeros(hs_pad.size(0), self.dunits) |
| 196 | |
| 197 | def rnn_forward(self, ey, z_list, c_list, z_prev, c_prev): |
| 198 | """Rnn forward. |
| 199 | |
| 200 | Args: |
| 201 | ey: TODO. |
| 202 | z_list: TODO. |
| 203 | c_list: TODO. |
| 204 | z_prev: TODO. |
| 205 | c_prev: TODO. |
| 206 | """ |
| 207 | if self.dtype == "lstm": |
| 208 | z_list[0], c_list[0] = self.decoder[0](ey, (z_prev[0], c_prev[0])) |
| 209 | for i in range(1, self.dlayers): |
| 210 | z_list[i], c_list[i] = self.decoder[i]( |
| 211 | self.dropout_dec[i - 1](z_list[i - 1]), |
| 212 | (z_prev[i], c_prev[i]), |
| 213 | ) |
| 214 | else: |
| 215 | z_list[0] = self.decoder[0](ey, z_prev[0]) |
| 216 | for i in range(1, self.dlayers): |
| 217 | z_list[i] = self.decoder[i](self.dropout_dec[i - 1](z_list[i - 1]), z_prev[i]) |
| 218 | return z_list, c_list |
| 219 | |
| 220 | def forward(self, hs_pad, hlens, ys_in_pad, ys_in_lens, strm_idx=0): |
| 221 | # to support mutiple encoder asr mode, in single encoder mode, |