code: def _decode_greedy_sequence(
      self,
      score_data,
      transition_params=None,
      allowed_transitions=None,
      use_log_space=True,
      use_start_and_end_states=False,
  ):
      scores = np.array(score_data)
      num_states = scores.shape[-1]
  
      if transition_params is None:
          if use_log_space:
              transition_params = np.zeros(num_states, num_states)
          else:
              transition_params = np.ones(num_states, num_states)
  
      if allowed_transitions is not None:
          if use_log_space:
              transition_mask = np.where(
                  allowed_transitions, 1, -float("inf")
              )
          else:
              transition_mask = np.where(allowed_transitions, 1, 0.0)
          transition_params = transition_params * transition_mask
  
      # Handle state 0.
      current_scores = scores[0]
      print(current_scores)
      if use_start_and_end_states:
          for i in range(num_states):
              if use_log_space:
                  current_scores[i] += transition_params[-1][i]
              else:
                  current_scores[i] *= transition_params[-1][i]
      sequence = [self._last_max(current_scores)]
  
      for score_idx in range(1, len(scores)):
          current_scores = scores[score_idx]
          for i in range(num_states):
              if use_log_space:
                  current_scores[i] += transition_params[sequence[-1]][
                      i
                  ]
              else:
                  current_scores[i] *= transition_params[sequence[-1]][
                      i
                  ]
          sequence.append(self._last_max(current_scores))
          print(current_scores)
  
      # Handle the end state if necessary. Since this is greedy, we can
      # simply multiply the final current_scores array by the end index
      # and overwrite the end of the sequence.
      if use_start_and_end_states:
          for i in range(num_states):
              if use_log_space:
                  current_scores[i] += transition_params[sequence[-1]][
                      -1
                  ]
              else:
                  current_scores[i] *= transition_params[sequence[-1]][
                      -1
                  ]
          sequence[-1] = self._last_max(current_scores)
  
      return sequence
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops.ragged import ragged_factory_ops
  from tensorflow.python.platform import test
  from tensorflow_text.python.ops import greedy_constrained_sequence_op
label_desc: Use image node_id 2 for calling the GreedyConstrainedSequenceOpTest obj's underlying member method code with example usage: obj._decode_greedy_sequence(score_data, transition_params, allowed_transitions, use_log_space, use_start_and_end_states) and returns: sequence