code: def test_log_probability(X, probs):
      p = [0.32]
      x = [[1.0], [0.0], [1.0], [1.0], [0.0]]
      y = [-1.139434, -0.385662, -1.139434, -1.139434, -0.385662]
  
      x_torch = torch.tensor(numpy.array(x))
      p_torch = torch.tensor(numpy.array(p))
  
      d1 = Bernoulli(p)
      d2 = Bernoulli(numpy.array(p, dtype=numpy.float64))
      d3 = torch.distributions.Bernoulli(p_torch)
  
      _test_predictions(x, y, d1.log_probability(x), torch.float32)
      _test_predictions(x, y, d2.log_probability(x), torch.float64)
      _test_predictions(
          x,
          d3.log_prob(x_torch).sum(axis=1),
          d2.log_probability(x),
          torch.float64,
      )
  
      x = [[1.0, 0.0, 1.0]]
      y = [-5.337058]
      p_torch = torch.tensor(numpy.array(probs))
      x_torch = torch.tensor(numpy.array(x))
  
      d1 = Bernoulli(probs)
      d2 = Bernoulli(numpy.array(probs, dtype=numpy.float64))
      d3 = torch.distributions.Bernoulli(p_torch)
  
      _test_predictions(x, y, d1.log_probability(x), torch.float32)
      _test_predictions(x, y, d2.log_probability(x), torch.float64)
      _test_predictions(
          x,
          d3.log_prob(x_torch).sum(axis=1),
          d2.log_probability(x),
          torch.float64,
      )
  
      p_torch = torch.tensor(numpy.array(probs))
      y = [
          -4.804842,
          -3.139834,
          -5.337058,
          -1.238875,
          -2.903883,
          -2.903883,
          -3.436099,
      ]
  
      d1 = Bernoulli(probs)
      d2 = Bernoulli(numpy.array(probs, dtype=numpy.float64))
      d3 = torch.distributions.Exponential(p_torch)
  
      _test_predictions(X, y, d1.log_probability(X), torch.float32)
      _test_predictions(X, y, d2.log_probability(X), torch.float64)
  
imports: import os
  import numpy
  import torch
  import pytest
  from pomegranate.distributions import Bernoulli
  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 15 for calling a global function with example usage: test_log_probability(X, probs) without return types