code: def decode(
      score,
      transition_params=None,
      allowed_transitions=None,
      use_log_space=True,
      use_start_and_end_states=False,
  ):
      """Decode the highest scoring sequence of tags.
  
      This function uses numpy instead of Tensorflow ops, and so cannot be used
      inside a Tensorflow graph or function.
  
      Args:
        score: A [seq_len, num_tags] matrix of unary potentials.
        transition_params: A [num_tags, num_tags] matrix of binary potentials.
        allowed_transitions: A [num_tags, num_tags] matrix where FALSE indicates
          a transition that cannot be taken.
        use_log_space: Whether to perform the Viterbi calculation in logarithmic
          space.
        use_start_and_end_states: If True, add an implicit 'start' and 'end' state
          to the start and end of the given sequence. If this is True,
          transition_params should contain an extra row and column, representing
          potentials for starting/ending a sequence with a given state. These values
          should occupy the outermost row and column of the transition_params
          matrix.
  
      Returns:
        viterbi: A [seq_len] list of integers containing the highest scoring tag
            indices.
        viterbi_score: A float containing the score for the Viterbi sequence.
      """
      if transition_params is None:
          num_tags = score.shape[-1]
          if use_log_space:
              transition_params = np.zeros(num_tags, num_tags)
          else:
              transition_params = np.ones(num_tags, num_tags)
  
      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
  
      if use_log_space:
          return _decode_in_log_space(
              score, transition_params, use_start_and_end_states
          )
      else:
          return _decode_in_exp_space(
              score, transition_params, use_start_and_end_states
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: decode(score, transition_params, allowed_transitions, use_log_space, use_start_and_end_states) and returns: _decode_in_log_space, _decode_in_exp_space