def hybrid_forward(self, F, data, valid_length): 
<EOL>if self._use_mean_pool:<EOL><INDENT>masked_encoded = F.SequenceMask(data,<EOL>sequence_length=valid_length,<EOL>use_sequence_length=True)<EOL>agg_state = F.broadcast_div(F.sum(masked_encoded, axis=<NUM_LIT:0>),<EOL>F.expand_dims(valid_length, axis=<NUM_LIT:1>))<EOL><DEDENT>else:<EOL><INDENT>agg_state = F.SequenceLast(data,<EOL>sequence_length=valid_length,<EOL>use_sequence_length=True)<EOL><DEDENT>return agg_state<EOL>
Forward logic