def hybrid_forward(self, F, inputs):
        # pylint: disable=arguments-differ
        """
        Compute context insensitive token embeddings for ELMo representations.

        Parameters
        ----------
        inputs : NDArray
            Shape (batch_size, sequence_length, max_character_per_token)
            of character ids representing the current batch.

        Returns
        -------
        token_embedding : NDArray
            Shape (batch_size, sequence_length, embedding_size) with context
            insensitive token representations.
        """
        # the character id embedding
        # (batch_size * sequence_length, max_chars_per_token, embed_dim)
        character_embedding = self._char_embedding(inputs.reshape((-1, self._max_chars_per_token)))

        character_embedding = F.transpose(character_embedding, axes=(1, 0, 2))
        token_embedding = self._convolutions(character_embedding)

        out_shape_ref = inputs.slice_axis(axis=-1, begin=0, end=1)
        out_shape_ref = out_shape_ref.broadcast_axes(axis=(2,),
                                                     size=(self._output_size))

        return token_embedding.reshape_like(out_shape_ref)
def hybrid_forward ( self , F , inputs ) : character_embedding = self . _char_embedding ( inputs . reshape ( ( - 1 , self . _max_chars_per_token ) ) ) character_embedding = F . transpose ( character_embedding , axes = ( 1 , 0 , 2 ) ) token_embedding = self . _convolutions ( character_embedding ) out_shape_ref = inputs . slice_axis ( axis = - 1 , begin = 0 , end = 1 ) out_shape_ref = out_shape_ref . broadcast_axes ( axis = ( 2 , ) , size = ( self . _output_size ) ) return token_embedding . reshape_like ( out_shape_ref )
Compute context insensitive token embeddings for ELMo representations.

        Parameters
        ----------
        inputs : NDArray
            Shape (batch_size, sequence_length, max_character_per_token)
            of character ids representing the current batch.

        Returns
        -------
        token_embedding : NDArray
            Shape (batch_size, sequence_length, embedding_size) with context
            insensitive token representations.