code: def sequence_decode(
      logits, transition_matrix, sequence_length, use_gpu_op, use_crf
  ):
      """A simple py_func wrapper around the Viterbi decode allowing it to be included in the tensorflow graph."""
      if not use_crf:
          return tf.argmax(input=logits, axis=-1), tf.nn.softmax(
              logits, -1
          )
  
      if use_gpu_op:
          tags, _ = tfa.text.crf.crf_decode(
              logits, transition_matrix, sequence_length
          )
          probs = tf.nn.softmax(logits, -1)
          return tags, probs
      else:
  
          def _sequence_decode(logits, transition_matrix):
              all_predictions = []
              all_logits = []
              for logit in logits:
                  viterbi_sequence, viterbi_logits = viterbi_decode(
                      logit, transition_matrix
                  )
                  all_predictions.append(viterbi_sequence)
                  all_logits.append(viterbi_logits)
              return np.array(
                  all_predictions, dtype=np.int32
              ), np.array(all_logits, dtype=np.float32)
  
          return tf.compat.v1.py_func(
              _sequence_decode,
              [logits, transition_matrix],
              [tf.int32, tf.float32],
          )
  
imports: import numpy
  import tensorflow
  import tensorflow_addons
label_desc: Use image node_id 3 for calling a global function with example usage: sequence_decode(logits, transition_matrix, sequence_length, use_gpu_op, use_crf) and returns: tf,  tf, tags,  probs, tf, np,  np