Forward logic

def hybrid_forward(self, F, data, valid_length): # pylint: disable=arguments-differ
        """Forward logic"""
        # Data will have shape (T, N, C)
        if self._use_mean_pool:
            masked_encoded = F.SequenceMask(data,
                                            sequence_length=valid_length,
                                            use_sequence_length=True)
            agg_state = F.broadcast_div(F.sum(masked_encoded, axis=0),
                                        F.expand_dims(valid_length, axis=1))
        else:
            agg_state = F.SequenceLast(data,
                                       sequence_length=valid_length,
                                       use_sequence_length=True)
        return agg_state