def forward(self, X):
s = X[:-<NUM_LIT:2>]<EOL>f = X[-<NUM_LIT:2>]<EOL>w = X[-<NUM_LIT:1>]<EOL>batch_size = len(f)<EOL>x_idx = self._cuda(<EOL>torch.as_tensor(np.arange(<NUM_LIT:1>, self.settings["<STR_LIT>"] + <NUM_LIT:1>)).repeat(<EOL>batch_size, <NUM_LIT:1><EOL>)<EOL>)<EOL>outputs = self._cuda(torch.Tensor([]))<EOL>for i in range(len(s)):<EOL><INDENT>state_word = self.lstms[<NUM_LIT:0>].init_hidden(batch_size)<EOL>output = self.lstms[<NUM_LIT:0>].forward(s[i][<NUM_LIT:0>], s[i][<NUM_LIT:1>], state_word)<EOL>outputs = torch.cat((outputs, output), <NUM_LIT:1>)<EOL><DEDENT>feaures = torch.cat((x_idx, f), <NUM_LIT:1>)<EOL>weights = torch.cat((outputs, w), <NUM_LIT:1>)<EOL>return self.sparse_linear(feaures, weights)<EOL>
Forward function.

        :param X: The input (batch) of the model contains word sequences for lstm,
            features and feature weights.
        :type X: For word sequences: a list of torch.Tensor pair (word sequence
            and word mask) of shape (batch_size, sequence_length).
            For features: torch.Tensor of shape (batch_size, sparse_feature_size).
            For feature weights: torch.Tensor of shape
            (batch_size, sparse_feature_size).
        :return: The output of LSTM layer.
        :rtype: torch.Tensor of shape (batch_size, num_classes)