def hybrid_forward(self, F, step_input, states, mask=None, position_weight=None):<EOL>
has_mem_mask = (len(states) == <NUM_LIT:3>)<EOL>if has_mem_mask:<EOL><INDENT>mem_value, mem_mask, steps = states<EOL><DEDENT>else:<EOL><INDENT>mem_value, steps = states<EOL>mem_mask = None<EOL><DEDENT>step_input = F.broadcast_add(step_input,<EOL>F.expand_dims(F.Embedding(steps,<EOL>position_weight,<EOL>self._max_length,<EOL>self._units),<EOL>axis=<NUM_LIT:0>))<EOL>if self._dropout:<EOL><INDENT>step_input = self.dropout_layer(step_input)<EOL><DEDENT>step_input = self.layer_norm(step_input)<EOL>inputs = step_input<EOL>outputs = inputs<EOL>step_additional_outputs = []<EOL>attention_weights_l = []<EOL>for cell in self.transformer_cells:<EOL><INDENT>outputs, attention_weights = cell(inputs, mem_value, mask, mem_mask)<EOL>if self._output_attention:<EOL><INDENT>attention_weights_l.append(attention_weights)<EOL><DEDENT>inputs = outputs<EOL><DEDENT>if self._output_attention:<EOL><INDENT>step_additional_outputs.extend(attention_weights_l)<EOL><DEDENT>return outputs, step_additional_outputs<EOL>
Parameters
----------
step_input : NDArray or Symbol, Shape (batch_size, length, C_in)
states : list of NDArray or Symbol
mask : NDArray or Symbol
position_weight : NDArray or Symbol

Returns
-------
step_output : NDArray or Symbol
    The output of the decoder. Shape is (batch_size, length, C_out)
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, length, mem_length) or
    (batch_size, num_heads, length, mem_length)