code: def brute_force_decode(sequence_lengths, inputs, transition_params):
      num_words = inputs.shape[0]
      num_tags = inputs.shape[1]
  
      all_sequence_scores = []
      all_sequences = []
  
      tag_indices_iterator = itertools.product(
          range(num_tags), repeat=sequence_lengths
      )
      inputs = tf.expand_dims(inputs, 0)
      sequence_lengths = tf.expand_dims(sequence_lengths, 0)
      transition_params = tf.constant(transition_params)
  
      # Compare the dynamic program with brute force computation.
      for tag_indices in tag_indices_iterator:
          tag_indices = list(tag_indices)
          tag_indices.extend([0] * (num_words - sequence_lengths))
          all_sequences.append(tag_indices)
          sequence_score = text.crf_sequence_score(
              inputs=inputs,
              tag_indices=tf.expand_dims(tag_indices, 0),
              sequence_lengths=sequence_lengths,
              transition_params=transition_params,
          )
          sequence_score = tf.squeeze(sequence_score, [0])
          all_sequence_scores.append(sequence_score)
  
      expected_max_sequence_index = np.argmax(all_sequence_scores)
      expected_max_sequence = all_sequences[expected_max_sequence_index]
      expected_max_score = all_sequence_scores[
          expected_max_sequence_index
      ]
      return expected_max_sequence, expected_max_score
  
imports: import itertools
  from packaging.version import Version
  import pytest
  import numpy
  import tensorflow
  from tensorflow_addons import text
  from tensorflow_addons.utils import test_utils
  from numpy.testing import assert_array_equal
label_desc: Use image node_id 2 for calling a global function with example usage: brute_force_decode(sequence_lengths, inputs, transition_params) and returns: expected_max_sequence,  expected_max_score