code: def test_serialization(inference_only):
      x_np, y_np = get_test_data()
      model = get_some_model(x_np, y_np, sanity_check=False)
  
      new_model = clone(model, inference_only)
      if inference_only:
          assert_all_equal(model.predict(x_np), new_model.predict(x_np))
          assert_all_equal(model.get_weights(), new_model.get_weights())
      else:
          original_loss = model.train_on_batch(
              x_np, y_np, return_dict=True
          )["crf_loss"]
          clone_loss = new_model.train_on_batch(
              x_np, y_np, return_dict=True
          )["crf_loss"]
          assert_all_equal(model.get_weights(), new_model.get_weights())
          assert original_loss == clone_loss
  
imports: import itertools
  import os
  import math
  import tempfile
  import pytest
  import numpy
  import tensorflow
  from tensorflow_addons.layers.crf import CRF
  from tensorflow_addons.text.crf import crf_log_likelihood
  from tensorflow_addons.utils import test_utils
label_desc: Use image node_id 12 for calling a global function with example usage: test_serialization(inference_only) without return types