def hybrid_forward(self, F, step_input, states):  
has_mem_mask = (len(states) == <NUM_LIT:4>)<EOL>if has_mem_mask:<EOL><INDENT>rnn_states, attention_output, mem_value, mem_masks = states<EOL>mem_masks = F.expand_dims(mem_masks, axis=<NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>rnn_states, attention_output, mem_value = states<EOL>mem_masks = None<EOL><DEDENT>new_rnn_states = []<EOL>rnn_out, layer_state =self.rnn_cells[<NUM_LIT:0>](F.concat(step_input, attention_output, dim=-<NUM_LIT:1>), rnn_states[<NUM_LIT:0>])<EOL>new_rnn_states.append(layer_state)<EOL>attention_vec, attention_weights =self.attention_cell(F.expand_dims(rnn_out, axis=<NUM_LIT:1>),  <EOL>mem_value,<EOL>mem_value,<EOL>mem_masks)<EOL>attention_vec = F.reshape(attention_vec, shape=(<NUM_LIT:0>, -<NUM_LIT:1>))<EOL>for i in range(<NUM_LIT:1>, len(self.rnn_cells)):<EOL><INDENT>curr_input = rnn_out<EOL>rnn_cell = self.rnn_cells[i]<EOL>rnn_out, layer_state = rnn_cell(F.concat(curr_input, attention_vec, dim=-<NUM_LIT:1>),<EOL>rnn_states[i])<EOL>rnn_out = self.dropout_layer(rnn_out)<EOL>if self._use_residual:<EOL><INDENT>rnn_out = rnn_out + curr_input<EOL><DEDENT>new_rnn_states.append(layer_state)<EOL><DEDENT>new_states = [new_rnn_states, attention_vec]<EOL>step_additional_outputs = []<EOL>if self._output_attention:<EOL><INDENT>step_additional_outputs.append(attention_weights)<EOL><DEDENT>return rnn_out, new_states, step_additional_outputs<EOL>
Parameters
----------
step_input : NDArray or Symbol
states : list of NDArray or Symbol

Returns
-------
step_output : NDArray or Symbol
    The output of the decoder. Shape is (batch_size, C_out)
new_states: list
    Includes

    - rnn_states : list of NDArray or Symbol
    - attention_vec : NDArray or Symbol, Shape (batch_size, C_memory)

step_additional_outputs : list
    Either be an empty list or contains the attention weights in this step.
    The attention weights will have shape (batch_size, 1, mem_length) or
    (batch_size, num_heads, 1, mem_length)