code: def test_sample(distributions):
      torch.manual_seed(0)
  
      X = IndependentComponents(distributions).sample(1)
      assert_array_almost_equal(X, [[3.508326, 0.269697, 1.0]], 4)
  
      X = IndependentComponents(distributions).sample(5)
      assert_array_almost_equal(
          X,
          [
              [1.5661, 0.0797, 1.0000],
              [0.1968, 0.5958, 0.0000],
              [0.4325, 0.8809, 1.0000],
              [0.8707, 0.0992, 0.0000],
              [0.3400, 0.5702, 1.0000],
          ],
          3,
      )
  
imports: import os
  import numpy
  import torch
  import pytest
  from pomegranate.distributions import Exponential
  from pomegranate.distributions import Gamma
  from pomegranate.distributions import Categorical
  from pomegranate.distributions import IndependentComponents
  from ._utils import _test_initialization_raises_one_parameter
  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 9 for calling a global function with example usage: test_sample(distributions) without return types