    def score(
        self, predictions: torch.Tensor, log_probabilities: torch.Tensor, end_index: int
    ) -> torch.Tensor:
        """
        Score the final predictions found by beam search.

        # Parameters

        predictions : `torch.Tensor`
            A tensor containing the initial predictions with shape `(batch_size, beam_size, max_steps)`.

        log_probabilities : `torch.Tensor`
            A tensor containing the log probabilities of the sequence, defined as the sum
            of the log probabilities per token, with shape `(batch_size, beam_size)`.

        end_index : `int`
            The index of the end symbol.

        # Returns

        `torch.Tensor`
            A tensor of the final sequence scores of shape `(batch_size, beam_size)`.
        """
        raise NotImplementedError
Score the final predictions found by beam search.

# Parameters

predictions : `torch.Tensor`
A tensor containing the initial predictions with shape `(batch_size, beam_size, max_steps)`.

log_probabilities : `torch.Tensor`
A tensor containing the log probabilities of the sequence, defined as the sum
of the log probabilities per token, with shape `(batch_size, beam_size)`.

end_index : `int`
The index of the end symbol.

# Returns

`torch.Tensor`
A tensor of the final sequence scores of shape `(batch_size, beam_size)`.
allennlp/nn/beam_search.py