code: def test_serialization(X, model):
      torch.save(model, ".pytest.torch")
      model2 = torch.load(".pytest.torch")
      os.system("rm .pytest.torch")
  
      assert_array_almost_equal(model2.priors, model.priors)
      assert_array_almost_equal(model2._log_priors, model._log_priors)
  
      assert_array_almost_equal(
          model2.predict_proba(X), model.predict_proba(X)
      )
  
      m1d1, m1d2 = model.distributions
      m2d1, m2d2 = model2.distributions
  
      assert m1d1 is not m2d1
      assert m1d2 is not m2d2
  
      assert_array_almost_equal(m1d1.scales, m2d1.scales)
      assert_array_almost_equal(m1d2.scales, m2d2.scales)
  
imports: import os
  import numpy
  import torch
  import pytest
  from pomegranate.gmm import GeneralMixtureModel
  from pomegranate.distributions import Exponential
  from .distributions._utils import _test_initialization_raises_one_parameter
  from .distributions._utils import _test_initialization
  from .distributions._utils import _test_predictions
  from .distributions._utils import _test_efd_from_summaries
  from .distributions._utils import _test_raises
  from nose.tools import assert_raises
  from numpy.testing import assert_array_almost_equal
label_desc: Use image node_id 36 for calling a global function with example usage: test_serialization(X, model) without return types