code: def test_serialization(X):
      d = Uniform().fit(X[:4])
      d.summarize(X[4:])
  
      assert_array_almost_equal(d.mins, [0.5, 0.2, 0.5])
      assert_array_almost_equal(d.maxs, [3.1, 2.1, 2.2])
  
      torch.save(d, ".pytest.torch")
      d2 = torch.load(".pytest.torch")
      os.system("rm .pytest.torch")
  
      assert_array_almost_equal(d2.mins, [0.5, 0.2, 0.5])
      assert_array_almost_equal(d2.maxs, [3.1, 2.1, 2.2])
  
      assert_array_almost_equal(d2._x_mins, [2.2, 1.0, 0.1])
      assert_array_almost_equal(d2._x_maxs, [5.4, 1.9, 4.0])
      assert_array_almost_equal(
          d2._logps, [-0.955511, -0.641854, -0.530628]
      )
      assert_array_almost_equal(
          d.log_probability(X), d2.log_probability(X)
      )
  
imports: import os
  import numpy
  import torch
  import pytest
  from pomegranate.distributions import Uniform
  from ._utils import _test_initialization_raises_two_parameters
  from ._utils import _test_initialization
  from ._utils import _test_predictions
  from ._utils import _test_efd_from_summaries
  from ._utils import _test_raises
  from nose.tools import assert_raises
  from numpy.testing import assert_array_almost_equal
label_desc: Use image node_id 39 for calling a global function with example usage: test_serialization(X) without return types