I\'m trying to implement a beam search decoding strategy in a text generation model. This is the function that I am using to decode the output probabilities.