code: def test_crf_decode(dtype):
      transition_params = np.array(
          [[-3, 5, -2], [3, 4, 1], [1, 2, 1]], dtype=dtype
      )
      # Test both the length-1 and regular cases.
      sequence_lengths_list = [
          np.array(3, dtype=np.int32),
          np.array(1, dtype=np.int64),
      ]
      inputs_list = [
          np.array(
              [[4, 5, -3], [3, -1, 3], [-1, 2, 1], [0, 0, 0]],
              dtype=dtype,
          ),
          np.array([[-1, 2, 1]], dtype=dtype),
      ]
      tag_indices_list = [
          np.array([1, 2, 1, 0], dtype=np.int32),
          np.array([2], dtype=np.int32),
      ]
  
      for sequence_lengths, inputs, tag_indices in zip(
          sequence_lengths_list, inputs_list, tag_indices_list
      ):
          (
              expected_max_sequence,
              expected_max_score,
          ) = brute_force_decode(
              sequence_lengths, inputs, transition_params
          )
  
          actual_max_sequence, actual_max_score = text.crf_decode(
              tf.expand_dims(inputs, 0),
              tf.constant(transition_params),
              tf.expand_dims(sequence_lengths, 0),
          )
          actual_max_sequence = tf.squeeze(actual_max_sequence, [0])
          actual_max_score = tf.squeeze(actual_max_score, [0])
  
          test_utils.assert_allclose_according_to_type(
              actual_max_score, expected_max_score, 1e-6, 1e-6
          )
          assert (
              list(actual_max_sequence[:sequence_lengths])
              == expected_max_sequence[:sequence_lengths]
          )
  
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 12 for calling a global function with example usage: test_crf_decode(dtype) without return types