code: def _get_symbols_to_logits_fn(self, max_decode_length):
      
  
      timing_signal = model_utils.get_position_encoding(
          max_decode_length + 1, self.params.hidden_size)
      decoder_self_attention_bias = model_utils.get_decoder_self_attention_bias(
          max_decode_length)
  
      def symbols_to_logits_fn(ids, i, cache):
        """Generate logits for next potential IDs.
  
        Args:
          ids: Current decoded sequences.
            int tensor with shape [batch_size * beam_size, i + 1]
          i: Loop index
          cache: dictionary of values storing the encoder output, encoder-decoder
            attention bias, and previous decoder attention values.
  
        Returns:
          Tuple of
            (logits with shape [batch_size * beam_size, vocab_size],
             updated cache values)
        """
        # Set decoder input to the last generated IDs
        decoder_input = ids[:, -1:]
  
        # Preprocess decoder input by getting embeddings and adding timing signal.
        decoder_input = self.embedding_softmax_layer(decoder_input)
        decoder_input += timing_signal[i:i + 1]
  
        self_attention_bias = decoder_self_attention_bias[:, :, i:i + 1, :i + 1]
        decoder_outputs = self.decoder_stack(
            decoder_input, cache.get("encoder_outputs"), self_attention_bias,
            cache.get("encoder_decoder_attention_bias"), cache)
        logits = self.embedding_softmax_layer.linear(decoder_outputs)
        logits = tf.squeeze(logits, axis=[1])
        return logits, cache
      return symbols_to_logits_fn
docs: Returns a decoding function that calculates logits of the next tokens.