code: def test_summarize_weighted_2d(X):
      d = Gamma()
      d.summarize(X[:4], sample_weight=X[:4])
      assert_array_almost_equal(d._w_sum, [6.1, 5.5, 6.2])
      assert_array_almost_equal(d._xw_sum, [13.03, 10.069999, 11.62])
      assert_array_almost_equal(
          d._logx_w_sum, [3.736675, 2.89909, 3.463712]
      )
  
      d.summarize(X[4:], sample_weight=X[4:])
      assert_array_almost_equal(d._w_sum, [17.1, 9.7, 10.6])
      assert_array_almost_equal(
          d._xw_sum, [58.59, 16.369999, 27.720001]
      )
      assert_array_almost_equal(
          d._logx_w_sum, [18.738672, 4.459686, 8.417439]
      )
  
      d = Gamma()
      d.summarize(X, sample_weight=X)
      assert_array_almost_equal(d._w_sum, [17.099998, 9.7, 10.599999])
      assert_array_almost_equal(
          d._xw_sum, [58.59, 16.369999, 27.720001]
      )
      assert_array_almost_equal(
          d._logx_w_sum, [18.73867, 4.459686, 8.417439], 4
      )
  
imports: import os
  import numpy
  import torch
  import pytest
  from pomegranate.distributions import Gamma
  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 24 for calling a global function with example usage: test_summarize_weighted_2d(X) without return types