Defines the forward computation.

        Parameters
        -----------
        inputs : NDArray
            input tensor with shape `(sequence_length, batch_size)`
            when `layout` is "TNC".
        begin_state : list
            initial recurrent state tensor with length equals to num_layers*2.
            For each layer the two initial states have shape `(batch_size, num_hidden)`
            and `(batch_size, num_projection)`
        sampled_values : list
            a list of three tensors for `sampled_classes` with shape `(num_samples,)`,
            `expected_count_sampled` with shape `(num_samples,)`, and
            `expected_count_true` with shape `(sequence_length, batch_size)`.

        Returns
        --------
        out : NDArray
            output tensor with shape `(sequence_length, batch_size, 1+num_samples)`
            when `layout` is "TNC".
        out_states : list
            output recurrent state tensor with length equals to num_layers*2.
            For each layer the two initial states have shape `(batch_size, num_hidden)`
            and `(batch_size, num_projection)`
        new_target : NDArray
            output tensor with shape `(sequence_length, batch_size)`
            when `layout` is "TNC".

def forward(self, inputs, label, begin_state, sampled_values): # pylint: disable=arguments-differ
        """Defines the forward computation.

        Parameters
        -----------
        inputs : NDArray
            input tensor with shape `(sequence_length, batch_size)`
            when `layout` is "TNC".
        begin_state : list
            initial recurrent state tensor with length equals to num_layers*2.
            For each layer the two initial states have shape `(batch_size, num_hidden)`
            and `(batch_size, num_projection)`
        sampled_values : list
            a list of three tensors for `sampled_classes` with shape `(num_samples,)`,
            `expected_count_sampled` with shape `(num_samples,)`, and
            `expected_count_true` with shape `(sequence_length, batch_size)`.

        Returns
        --------
        out : NDArray
            output tensor with shape `(sequence_length, batch_size, 1+num_samples)`
            when `layout` is "TNC".
        out_states : list
            output recurrent state tensor with length equals to num_layers*2.
            For each layer the two initial states have shape `(batch_size, num_hidden)`
            and `(batch_size, num_projection)`
        new_target : NDArray
            output tensor with shape `(sequence_length, batch_size)`
            when `layout` is "TNC".
        """
        encoded = self.embedding(inputs)
        length = inputs.shape[0]
        batch_size = inputs.shape[1]
        encoded, out_states = self.encoder.unroll(length, encoded, begin_state,
                                                  layout='TNC', merge_outputs=True)
        out, new_target = self.decoder(encoded, sampled_values, label)
        out = out.reshape((length, batch_size, -1))
        new_target = new_target.reshape((length, batch_size))
        return out, out_states, new_target