def forward(self, x, w):
if self.bias is None:<EOL><INDENT>return (w.unsqueeze(<NUM_LIT:2>) * self.weight(x)).sum(dim=<NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>return (w.unsqueeze(<NUM_LIT:2>) * self.weight(x)).sum(dim=<NUM_LIT:1>) + self.bias<EOL><DEDENT>
Forward function.

        :param x: Feature indices.
        :type x: torch.Tensor of shape (batch_size * length)
        :param w: Feature weights.
        :type w: torch.Tensor of shape (batch_size * length)
        :return: Output of linear layer.
        :rtype: torch.Tensor of shape (batch_size, num_classes)